Skip to content

Commit a62b99b

Browse files
s07641069andriy-bilynskyy
authored andcommitted
soc: riscv: telink_w91: Fix mcuboot
- clear IPC remote TX buffer every boot - use magic and header only for bootable image - add mcuboot related CI tasks Signed-off-by: Alex Tsitsiura <s07641069@gmail.com>
1 parent a41b5a0 commit a62b99b

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

.github/workflows/telink-w91-build.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,25 @@ jobs:
5858
cd ..
5959
west build -b tlsr9118bdk40d -d build_nvs_w91 zephyr/samples/subsys/nvs
6060
61+
- name: Build W91 bootloader/mcuboot/boot
62+
run: |
63+
cd ..
64+
west build -b tlsr9118bdk40d -d build_mcuboot_w91 bootloader/mcuboot/boot/zephyr -- -DCONFIG_LOG_DEFAULT_LEVEL=3
65+
66+
- name: Build W91 basic/blinky for DFU
67+
run: |
68+
cd ..
69+
west build -b tlsr9118bdk40d -d build_blinky_dfu_w91 zephyr/samples/basic/blinky -- -DCONFIG_BOOTLOADER_MCUBOOT=y
70+
6171
- name: Collect artifacts
6272
run: |
6373
mkdir telink_build_artifacts
6474
cp ../build_blinky_w91/zephyr/zephyr.bin telink_build_artifacts/w91_blinky.bin
6575
cp ../build_button_w91/zephyr/zephyr.bin telink_build_artifacts/w91_button.bin
6676
cp ../build_mpu6050_w91/zephyr/zephyr.bin telink_build_artifacts/w91_mpu6050.bin
77+
cp ../build_nvs_w91/zephyr/zephyr.bin telink_build_artifacts/w91_nvs.bin
78+
cp ../build_mcuboot_w91/zephyr/zephyr.bin telink_build_artifacts/w91_mcuboot.bin
79+
cp ../build_blinky_dfu_w91/zephyr/zephyr.signed.bin telink_build_artifacts/w91_blinky_dfu.signed.bin
6780
6881
- name: Publish artifacts
6982
uses: actions/upload-artifact@v3

soc/riscv/riscv-privilege/telink_w91/start.S

+18-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include "soc.h"
1111

1212
#define N22_CORE_START (DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) + DT_REG_SIZE(DT_CHOSEN(zephyr_flash)))
13+
#define IPC_REMOTE_TX_START (DT_REG_ADDR(DT_N_NODELABEL_sram_rx))
14+
#define IPC_REMOTE_TX_END (IPC_REMOTE_TX_START + DT_REG_SIZE(DT_N_NODELABEL_sram_rx))
1315

1416
.option push
1517
.option norelax
@@ -23,16 +25,30 @@ reset_vector:
2325
.global _start
2426
.type _start,@function
2527

26-
.word (0x31707848) #/ magic
28+
#if !defined(CONFIG_BOOTLOADER_MCUBOOT)
29+
.word (0x31707848) #/ magic
2730
.word (0x33e90d91) #/ header crc32
2831
.org 0x14
2932
.word (0xa0000080) #/ start address
3033

3134
.org 0xa0
35+
#endif
36+
3237
_start: #/ after reset starts on D25 core
3338

39+
lui t0, 0
40+
la t2, IPC_REMOTE_TX_START
41+
la t3, IPC_REMOTE_TX_END
42+
_ZERO_IPC_REMOTE_TX_BEGIN:
43+
bleu t3, t2, _start_n22
44+
sw t0, 0(t2)
45+
addi t2, t2, 4
46+
j _ZERO_IPC_REMOTE_TX_BEGIN
47+
48+
_start_n22:
49+
3450
lui t0, 0xf0100
35-
lui t1, %hi(N22_CORE_START)
51+
lui t1, %hi(N22_CORE_START)
3652
addi t1, t1, %lo(N22_CORE_START)
3753
sw t1, 0x204(t0) #/ N22 core address: 0xf0100204 <- N22_CORE_START
3854
lui t0, 0xf1700

0 commit comments

Comments
 (0)