Skip to content

boards/stm32l4: add riotboot support#11701

Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/riotboot/stm32l4
Jul 4, 2019
Merged

boards/stm32l4: add riotboot support#11701
aabadie merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/riotboot/stm32l4

Conversation

@aabadie
Copy link
Contributor

@aabadie aabadie commented Jun 14, 2019

Contribution description

Now that #11643 is merged, this PR adds riotboot to all stm32l4 based boards. Changes provided in #11643 are compatible for all L4.

Not tested yet.

Testing procedure

  • Flash riotboot and check application is working:
$ make BOARD=nucleo-l476rg -C tests/riotboot riotboot/flash term
> help
> curslotnr
  • Flash an image on slot0:
    $ make BOARD=nucleo-l476rg -C tests/riotboot riotboot/flash-slot0 term

curslotnr # Should return slot 0

- Flash an image on slot1:
$ make BOARD=nucleo-l476rg -C tests/riotboot riotboot/flash-slot1 term
> curslotnr  # Should return slot 1

Issues/PRs references

Follow-up of #11643

@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: boards Area: Board ports Area: OTA Area: Over-the-air updates labels Jun 14, 2019
@aabadie aabadie requested a review from fjmolinas June 14, 2019 14:59
@aabadie aabadie force-pushed the pr/riotboot/stm32l4 branch from b090042 to a5f1b1f Compare June 20, 2019 08:19
@aabadie
Copy link
Contributor Author

aabadie commented Jun 20, 2019

I just tested this PR on related L4 boards (except stm32l476-disco but it's the same CPU as nucleo-l476rg). I works except for nucleo-l432kc and nucleo-l433rc.
I need to find out what's different on them. Maybe I can remove them from this PR and open a follow-p once I can make them work ? @fjmolinas any thoughts?

@aabadie
Copy link
Contributor Author

aabadie commented Jun 27, 2019

I works except for nucleo-l432kc and nucleo-l433rc.

I tested this again today but couldn't make it work on nucleo-l433rc. It looks like there's an issue when erasing/writing on the flash with these boards.
OpenOCD probably has the same issue because flashing the extended slot0 fails all the time.

I propose to dropped those 2 boards from this PR and try to fix this in follow-up PRs. @fjmolinas, is it ok for you ?

@aabadie aabadie force-pushed the pr/riotboot/stm32l4 branch from a5f1b1f to e7aed66 Compare June 28, 2019 14:43
@aabadie
Copy link
Contributor Author

aabadie commented Jun 28, 2019

I dropped the changes of nucleo-l432kc and nucleo-l433rc from this PR as it's still unclear what is the problem. Boards that work fine: nucleo-f496zg, b-l475-iot01a and stm32l476g-disco. nucleo-l452re is untested (I can't test this one)

@fjmolinas
Copy link
Contributor

I'm not able to reproduce your issue for nucleo-l433rc, after flashing slot0/1:

2019-07-03 09:59:55,157 - INFO # Hello riotboot!
2019-07-03 09:59:55,160 - INFO # You are running RIOT on a(n) nucleo-l433rc board.
2019-07-03 09:59:55,163 - INFO # This board features a(n) stm32l4 MCU.
2019-07-03 09:59:55,166 - INFO # riotboot_test: running from slot 0
2019-07-03 09:59:55,170 - INFO # Image magic_number: 0x544f4952
2019-07-03 09:59:55,173 - INFO # Image Version: 0x5d1c6078
2019-07-03 09:59:55,174 - INFO # Image start address: 0x08001200
2019-07-03 09:59:55,176 - INFO # Header chksum: 0x22b17536
2019-07-03 09:59:55,177 - INFO # 
2019-07-03 10:00:06,192 - INFO #  main(): This is RIOT! (Version: 2019.07-devel-759-ge7aed-pr-11701)
2019-07-03 10:00:06,195 - INFO # Hello riotboot!
2019-07-03 10:00:06,197 - INFO # You are running RIOT on a(n) nucleo-l433rc board.
2019-07-03 10:00:06,199 - INFO # This board features a(n) stm32l4 MCU.
2019-07-03 10:00:06,202 - INFO # riotboot_test: running from slot 1
2019-07-03 10:00:06,205 - INFO # Image magic_number: 0x544f4952
2019-07-03 10:00:06,207 - INFO # Image Version: 0x5d1c6084
2019-07-03 10:00:06,210 - INFO # Image start address: 0x08020a00
2019-07-03 10:00:06,213 - INFO # Header chksum: 0x12e36d44
2019-07-03 10:00:06,213 - INFO # 

After applying #11776, tests/riotboot_flashwrite was also working for me.#11776.

I don't have nucleo-l432kc ATM to test.

@fjmolinas
Copy link
Contributor

Ran successfully tests/riotboot_flashwrite on:

  • nucleo-l433rc
  • stm32l476g-disco

I don't have b-l475-iot01a, nucleo-l432kc, nucleo-f496zg or nucleo-l452re. @aabadie could you lend me the first 3 tomorrow?

@rdagher I think you have a nucleo-l452re, do you think you could test?

@aabadie
Copy link
Contributor Author

aabadie commented Jul 3, 2019

After applying #11776, tests/riotboot_flashwrite was also working for me.

Are you sure no commits from #11776 were built in the firmware ? because for me it never worked.
I think nucleo-l432kc is in your office somewhere (I saw it yesterday ;) ), it's a nucleo-32 version.

@fjmolinas
Copy link
Contributor

I think nucleo-l432kc is in your office somewhere (I saw it yesterday ;) ), it's a nucleo-32 version.

@aabadie You are right I though it was an f103 because it actually has one on the other side of the board (the stlink).

Anyway testing with your branch:

2019-07-03 16:04:07,823 - INFO # Hello riotboot!
2019-07-03 16:04:07,828 - INFO # You are running RIOT on a(n) nucleo-l432kc board.
2019-07-03 16:04:07,831 - INFO # This board features a(n) stm32l4 MCU.
2019-07-03 16:04:07,834 - INFO # riotboot_test: running from slot 0
2019-07-03 16:04:07,837 - INFO # Image magic_number: 0x544f4952
2019-07-03 16:04:07,840 - INFO # Image Version: 0x5d1cb5d2
2019-07-03 16:04:07,842 - INFO # Image start address: 0x08001200
2019-07-03 16:04:07,844 - INFO # Header chksum: 0x781aca90
2019-07-03 16:04:07,844 - INFO # 
> 2019-07-03 16:04:23,887 - INFO #  main(): This is RIOT! (Version: 2019.07-devel-759-ge7aed-pr-11701)
2019-07-03 16:04:23,889 - INFO # Hello riotboot!
2019-07-03 16:04:23,892 - INFO # You are running RIOT on a(n) nucleo-l432kc board.
2019-07-03 16:04:23,896 - INFO # This board features a(n) stm32l4 MCU.
2019-07-03 16:04:23,899 - INFO # riotboot_test: running from slot 1
2019-07-03 16:04:23,901 - INFO # Image magic_number: 0x544f4952
2019-07-03 16:04:23,904 - INFO # Image Version: 0x5d1cb5e6
2019-07-03 16:04:23,907 - INFO # Image start address: 0x08020a00
2019-07-03 16:04:23,909 - INFO # Header chksum: 0x686cc2a6
2019-07-03 16:04:23,910 - INFO # 

Could it be an openocd version?


Open On-Chip Debugger 0.10.0+dev-00704-gdb429c34 (2019-03-08-12:14)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html

@fjmolinas
Copy link
Contributor

fjmolinas commented Jul 3, 2019

Are you sure no commits from #11776 were built in the firmware ? because for me it never worked.

Yes, since if I remember well you where having flashing issues, and the changes in #11776 target flashpage code.

@aabadie
Copy link
Contributor Author

aabadie commented Jul 3, 2019

Could it be an openocd version?

That could be but I rebuilt it very recently.

Open On-Chip Debugger 0.10.0+dev-00629-g46325790 (2019-06-05-14:34)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html

@fjmolinas
Copy link
Contributor

Ran successfully tests/riotboot_flashwrite on:

  • b-l475-iot01a
  • nucleo-l496zg

@aabadie
Copy link
Contributor Author

aabadie commented Jul 4, 2019

After more investigation, I seems that my OpenOCD version was older than I thought and was missing a commit fixing support for single bank stm32l4. The commit in question is openocd-org/openocd@a4d5054.

After updating OpenOCD to latest master and checking that it contains the fix commit, I was able to flash a nucleo-l432kc.

So I'll re-add support for this board and nucleo-l433rc and add a comment regarding OpenOCD version for this 2 boards.

@aabadie
Copy link
Contributor Author

aabadie commented Jul 4, 2019

@fjmolinas, I updated the PR following my previous comment. There's a comment in nucleo-l43x boards mentioning the potential problem with OpenOCD.

Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested for all platforms, please squash!

@aabadie aabadie force-pushed the pr/riotboot/stm32l4 branch from 3a10e48 to 342f3e8 Compare July 4, 2019 08:35
@aabadie
Copy link
Contributor Author

aabadie commented Jul 4, 2019

All green, go!

@aabadie aabadie merged commit 2f95d79 into RIOT-OS:master Jul 4, 2019
@aabadie aabadie deleted the pr/riotboot/stm32l4 branch July 4, 2019 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports Area: OTA Area: Over-the-air updates CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants