mirror of https://github.com/wolfSSL/wolfBoot.git
Added renode board: nrf52840
parent
11d7a67498
commit
f2280f5575
|
@ -0,0 +1,25 @@
|
||||||
|
ARCH?=ARM
|
||||||
|
TARGET?=nrf52
|
||||||
|
SIGN?=ECC256
|
||||||
|
HASH?=SHA256
|
||||||
|
DEBUG?=0
|
||||||
|
VTOR?=1
|
||||||
|
CORTEX_M0?=0
|
||||||
|
NO_ASM?=0
|
||||||
|
NO_MPU=1
|
||||||
|
EXT_FLASH?=0
|
||||||
|
SPI_FLASH?=0
|
||||||
|
ALLOW_DOWNGRADE?=0
|
||||||
|
NVM_FLASH_WRITEONCE?=0
|
||||||
|
WOLFBOOT_VERSION?=0
|
||||||
|
V?=0
|
||||||
|
SPMATH?=1
|
||||||
|
RAM_CODE?=0
|
||||||
|
DUALBANK_SWAP?=0
|
||||||
|
IMAGE_HEADER_SIZE?=256
|
||||||
|
PKA?=0
|
||||||
|
WOLFBOOT_PARTITION_SIZE?=0x40000
|
||||||
|
WOLFBOOT_SECTOR_SIZE?=0x1000
|
||||||
|
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x20000
|
||||||
|
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x60000
|
||||||
|
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xe0000
|
|
@ -31,6 +31,18 @@
|
||||||
#define GPIO_OUTCLR *((volatile uint32_t *)(GPIO_BASE + 0x50C))
|
#define GPIO_OUTCLR *((volatile uint32_t *)(GPIO_BASE + 0x50C))
|
||||||
#define GPIO_PIN_CNF ((volatile uint32_t *)(GPIO_BASE + 0x700)) // Array
|
#define GPIO_PIN_CNF ((volatile uint32_t *)(GPIO_BASE + 0x700)) // Array
|
||||||
|
|
||||||
|
|
||||||
|
#define BAUD_115200 0x01D7E000
|
||||||
|
|
||||||
|
#define UART0_BASE (0x40002000)
|
||||||
|
#define UART0_TASK_STARTTX *((volatile uint32_t *)(UART0_BASE + 0x008))
|
||||||
|
#define UART0_TASK_STOPTX *((volatile uint32_t *)(UART0_BASE + 0x00C))
|
||||||
|
#define UART0_EVENT_ENDTX *((volatile uint32_t *)(UART0_BASE + 0x120))
|
||||||
|
#define UART0_ENABLE *((volatile uint32_t *)(UART0_BASE + 0x500))
|
||||||
|
#define UART0_TXD_PTR *((volatile uint32_t *)(UART0_BASE + 0x544))
|
||||||
|
#define UART0_TXD_MAXCOUNT *((volatile uint32_t *)(UART0_BASE + 0x548))
|
||||||
|
#define UART0_BAUDRATE *((volatile uint32_t *)(UART0_BASE + 0x524))
|
||||||
|
|
||||||
static void gpiotoggle(uint32_t pin)
|
static void gpiotoggle(uint32_t pin)
|
||||||
{
|
{
|
||||||
uint32_t reg_val = GPIO_OUT;
|
uint32_t reg_val = GPIO_OUT;
|
||||||
|
@ -38,12 +50,42 @@ static void gpiotoggle(uint32_t pin)
|
||||||
GPIO_OUTSET = (~reg_val) & (1 << pin);
|
GPIO_OUTSET = (~reg_val) & (1 << pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void uart_init(void)
|
||||||
|
{
|
||||||
|
UART0_BAUDRATE = BAUD_115200;
|
||||||
|
UART0_ENABLE = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_write(char c)
|
||||||
|
{
|
||||||
|
UART0_EVENT_ENDTX = 0;
|
||||||
|
|
||||||
|
UART0_TXD_PTR = &c;
|
||||||
|
UART0_TXD_MAXCOUNT = 1;
|
||||||
|
UART0_TASK_STARTTX = 1;
|
||||||
|
while(UART0_EVENT_ENDTX == 0)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char START='*';
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
//uint32_t pin = 19;
|
//uint32_t pin = 19;
|
||||||
uint32_t pin = 6;
|
uint32_t pin = 6;
|
||||||
int i;
|
int i;
|
||||||
|
uint32_t version = 0;
|
||||||
|
uint8_t *v_array = (uint8_t *)&version;
|
||||||
GPIO_PIN_CNF[pin] = 1; /* Output */
|
GPIO_PIN_CNF[pin] = 1; /* Output */
|
||||||
|
|
||||||
|
version = wolfBoot_current_firmware_version();
|
||||||
|
|
||||||
|
uart_init();
|
||||||
|
uart_write(START);
|
||||||
|
for (i = 3; i >= 0; i--) {
|
||||||
|
uart_write(v_array[i]);
|
||||||
|
}
|
||||||
while(1) {
|
while(1) {
|
||||||
gpiotoggle(pin);
|
gpiotoggle(pin);
|
||||||
for (i = 0; i < 800000; i++) // Wait a bit.
|
for (i = 0; i < 800000; i++) // Wait a bit.
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
:name: NRF52840
|
||||||
|
:description: This script runs wolfboot on NRF52840.
|
||||||
|
|
||||||
|
using sysbus
|
||||||
|
|
||||||
|
mach create
|
||||||
|
machine LoadPlatformDescription @platforms/cpus/nrf52840.repl
|
||||||
|
|
||||||
|
|
||||||
|
emulation CreateUartPtyTerminal "term" "/tmp/wolfboot.uart" True
|
||||||
|
connector Connect uart0 term
|
||||||
|
|
||||||
|
cpu PerformanceInMips 100
|
||||||
|
|
||||||
|
macro reset
|
||||||
|
"""
|
||||||
|
### Load bootloader + signed image
|
||||||
|
sysbus LoadELF @/tmp/renode-wolfboot.elf
|
||||||
|
sysbus LoadBinary @/tmp/renode-test-v1.bin 0x20000
|
||||||
|
start
|
||||||
|
|
||||||
|
"""
|
||||||
|
runMacro $reset
|
|
@ -2,8 +2,8 @@ TEST_UPDATE_VERSION?=2
|
||||||
WOLFBOOT_VERSION?=0
|
WOLFBOOT_VERSION?=0
|
||||||
RENODE_UART=/tmp/wolfboot.uart
|
RENODE_UART=/tmp/wolfboot.uart
|
||||||
RENODE_PORT=55155
|
RENODE_PORT=55155
|
||||||
RENODE_OPTIONS=--pid-file=/tmp/renode.pid -P $(RENODE_PORT)
|
RENODE_OPTIONS=--pid-file=/tmp/renode.pid
|
||||||
RENODE_OPTIONS+=--disable-xwt
|
RENODE_OPTIONS+=--disable-xwt -P $(RENODE_PORT)
|
||||||
RENODE_CONFIG=tools/renode/stm32f4_discovery_wolfboot.resc
|
RENODE_CONFIG=tools/renode/stm32f4_discovery_wolfboot.resc
|
||||||
POFF=131067
|
POFF=131067
|
||||||
|
|
||||||
|
@ -40,6 +40,10 @@ ifeq ($(TARGET),hifive1)
|
||||||
RENODE_CONFIG=tools/renode/sifive_fe310_wolfboot.resc
|
RENODE_CONFIG=tools/renode/sifive_fe310_wolfboot.resc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET),nrf52)
|
||||||
|
RENODE_CONFIG=tools/renode/nrf52840_wolfboot.resc
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(SIGN),NONE)
|
ifeq ($(SIGN),NONE)
|
||||||
SIGN_ARGS+=--no-sign
|
SIGN_ARGS+=--no-sign
|
||||||
endif
|
endif
|
||||||
|
@ -76,7 +80,8 @@ endif
|
||||||
#
|
#
|
||||||
renode-on: FORCE
|
renode-on: FORCE
|
||||||
@rm -f /tmp/wolfboot.uart
|
@rm -f /tmp/wolfboot.uart
|
||||||
@renode $(RENODE_OPTIONS) $(RENODE_CONFIG) 2>&1 >/tmp/renode.log &
|
#@renode $(RENODE_OPTIONS) $(RENODE_CONFIG) 2>&1 >/tmp/renode.log &
|
||||||
|
@renode $(RENODE_OPTIONS) $(RENODE_CONFIG) &
|
||||||
@while ! (test -e /tmp/wolfboot.uart); do sleep .1; done
|
@while ! (test -e /tmp/wolfboot.uart); do sleep .1; done
|
||||||
@echo "Renode up: uart port activated"
|
@echo "Renode up: uart port activated"
|
||||||
@echo "Renode running: renode has been started."
|
@echo "Renode running: renode has been started."
|
||||||
|
|
Loading…
Reference in New Issue