找回密码
 立即注册

微信扫码登录

查看: 6779|回复: 4

[reprinted] Mcuboot for telink microcontroller (tlsr9518adk80d kit) in zephyr

[复制链接]

10

主题

61

回帖

1014

积分

版主

积分
1014
发表于 2024-8-28 17:36:18 | 显示全部楼层 |阅读模式 来自 上海
Transferred from old forum Author:  Majd

Hello every body!

I m working on a project for a Telink microcontroller (exactly the tlsr9518adk80d kit).

I am using zephyr_SDK v3.3.99 and everything is ok and all functions are working very well.
Now I want to make my code to be started by the bootloader.
So:
- I built the Mcuboot for tlsr9518adk80d, and flashed it to address 0x0 in flash.
- I added (CONFIG_BOOTLOADER_MCUBOOT=y) in prj.conf of my project, build the project, signed the .bin file, and flashed it into slot 0 on the flash.

Bootloader starts normally and can see the image, confirm it s validity, and jump to the correct address on the flash. But.. the code does not start....

I repeated the work for (Blinky project and hellow_world project) but got the same result.
All these codes work normally without bootloader but with bootloader nothing works.

issue_6.png

Is the Telink microcontroller needs to add some configuration in prj.conf ??

Can you help me deal with this problem.

10

主题

61

回帖

1014

积分

版主

积分
1014
 楼主| 发表于 2024-8-28 17:36:41 | 显示全部楼层 来自 上海
Your address seems wrong, as the tlsr9518adk80d.dts file shows, the slot0 is 0x18000, not 0x10080.

On my side everything works fine, here's my steps(use hello_word as example):

1. build mcuboot

west build -b tlsr9518adk80d -d build_mcuboot bootloader/mcuboot/boot/zephyr

2. build hello_word sample

west build -b tlsr9518adk80d -s zephyr/samples/hello_world -d build-hello-signed -- \ -DCONFIG_BOOTLOADER_MCUBOOT=y \ -DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE=\"bootloader/mcuboot/root-rsa-2048.pem\"

3. sign the hello_word sample

west sign -t imgtool -p bootloader/mcuboot/scripts/imgtool.py -d build-hello-signed -- --key bootloader/mcuboot/root-rsa-2048.pem

4. flash mcuboot to address 0x0, flash signed hello word sample(zephyr.signed.bin, not zephyr.bin) to address 0x18000, then it works.

10

主题

61

回帖

1014

积分

版主

积分
1014
 楼主| 发表于 2024-8-28 17:37:51 | 显示全部楼层 来自 上海
TL_WH 发表于 2024-8-28 17:36
Your address seems wrong, as the tlsr9518adk80d.dts file shows, the slot0 is 0x18000, not 0x10080.

...

Thank you very much!
I will try your steps exactly. but now I have another problem (my tlsr9518adk80d does not work)

I noticed that, on my version of zephyr the slot-0 start from 0x10000, and the offset 0x80 is because I uses the sign key with pad-header 128 bytes. Signing the .bin code without adding the header will return me an error.

west sign -d build_hellow_world -t imgtool -- --pad --version 1.1.2 --pad-header --header-size 128 --key root-rsa-2048.pem

Now i am sure that the problem in the version of zephyr_SDK. Could you tell me please which version of zephyr you are using?

issue_6_02.png

10

主题

61

回帖

1014

积分

版主

积分
1014
 楼主| 发表于 2024-8-28 17:38:08 | 显示全部楼层 来自 上海
TL_WH 发表于 2024-8-28 17:37
Thank you very much!
I will try your steps exactly. but now I have another problem (my tlsr9518adk ...

I‘m using the Zephyr from telink-semi repo, here is the specific Zephyr commit id: 873afebff10dc02ec881e2432a885e54c9f67b10

Here's the link: https://github.com/telink-semi/z ... 2432a885e54c9f67b10

10

主题

61

回帖

1014

积分

版主

积分
1014
 楼主| 发表于 2024-8-28 17:38:21 | 显示全部楼层 来自 上海
TL_WH 发表于 2024-8-28 17:38
I‘m using the Zephyr from telink-semi repo, here is the specific Zephyr commit id: 873afebff10dc0 ...

Thank you very much.
Yes, the problem was resolved by replacing the Zephyr.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Telink forum ( 沪ICP备17008231号-1 )

GMT+8, 2026-8-27 05:39 , Processed in 0.081840 second(s), 25 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表