Skip to content

makefiles/edbg.inc.mk: use FLASHFILE#11172

Merged
dylad merged 2 commits intoRIOT-OS:masterfrom
cladmi:pr/make/flashfile/edbg
Mar 26, 2019
Merged

makefiles/edbg.inc.mk: use FLASHFILE#11172
dylad merged 2 commits intoRIOT-OS:masterfrom
cladmi:pr/make/flashfile/edbg

Conversation

@cladmi
Copy link
Copy Markdown
Contributor

@cladmi cladmi commented Mar 13, 2019

Contribution description

Update to use FLASHFILE as file to be flashed on the board.

This also now removes the compatibility hack in riotboot.

Testing procedure

We need to test that boards using edbg would still work with this.

Boards using edbg:

echo ${EDBG_BOARDS} 
arduino-zero samd21-xpro saml10-xpro saml11-xpro saml21-xpro samr21-xpro samr30-xpro

Test flashing normal examples with the board

Test without board

I replaced FLASHER by 'true' to only show the FFLAGS and get the same output with master and this pull request:

for board in ${EDBG_BOARDS} ; do echo ${board}; BOARD=${board} make -C examples/hello-world/ --no-print-directory FLASHER=true flash-only; done
arduino-zero
true  -t atmel_cm0p -b -v -p -f /home/harter/work/git/RIOT/examples/hello-world/bin/arduino-zero/hello-world.bin
samd21-xpro
true  -t atmel_cm0p -b -v -p -f /home/harter/work/git/RIOT/examples/hello-world/bin/samd21-xpro/hello-world.bin
saml10-xpro
true  -t mchp_cm23 -b -v -p -f /home/harter/work/git/RIOT/examples/hello-world/bin/saml10-xpro/hello-world.bin
saml11-xpro
true  -t mchp_cm23 -b -v -p -f /home/harter/work/git/RIOT/examples/hello-world/bin/saml11-xpro/hello-world.bin
saml21-xpro
true  -t atmel_cm0p -b -v -p -f /home/harter/work/git/RIOT/examples/hello-world/bin/saml21-xpro/hello-world.bin
samr21-xpro
true  -t atmel_cm0p -b -v -p -f /home/harter/work/git/RIOT/examples/hello-world/bin/samr21-xpro/hello-world.bin
samr30-xpro
true  -t atmel_cm0p -b -v -p -f /home/harter/work/git/RIOT/examples/hello-world/bin/samr30-xpro/hello-world.bin

FLASHFILE can be updated

When setting FLASHFILE to another value from environment, like $(ELFFILE) it is correctly taken into account.

for board in ${EDBG_BOARDS} ; do echo ${board}; FLASHFILE='$(ELFFILE)' BOARD=${board} make -C examples/hello-world/ --no-print-directory FLASHER=true flash-only; done
wdiff output_master output_pr

arduino-zero
true  -t atmel_cm0p -b -v -p -f [-/home/harter/work/git/RIOT/examples/hello-world/bin/arduino-zero/hello-world.bin-] {+/home/harter/work/git/RIOT/examples/hello-world/bin/arduino-zero/hello-world.elf+}
samd21-xpro
true  -t atmel_cm0p -b -v -p -f [-/home/harter/work/git/RIOT/examples/hello-world/bin/samd21-xpro/hello-world.bin-] {+/home/harter/work/git/RIOT/examples/hello-world/bin/samd21-xpro/hello-world.elf+}
saml10-xpro
true  -t mchp_cm23 -b -v -p -f [-/home/harter/work/git/RIOT/examples/hello-world/bin/saml10-xpro/hello-world.bin-] {+/home/harter/work/git/RIOT/examples/hello-world/bin/saml10-xpro/hello-world.elf+}
saml11-xpro
true  -t mchp_cm23 -b -v -p -f [-/home/harter/work/git/RIOT/examples/hello-world/bin/saml11-xpro/hello-world.bin-] {+/home/harter/work/git/RIOT/examples/hello-world/bin/saml11-xpro/hello-world.elf+}
saml21-xpro
true  -t atmel_cm0p -b -v -p -f [-/home/harter/work/git/RIOT/examples/hello-world/bin/saml21-xpro/hello-world.bin-] {+/home/harter/work/git/RIOT/examples/hello-world/bin/saml21-xpro/hello-world.elf+}
samr21-xpro
true  -t atmel_cm0p -b -v -p -f [-/home/harter/work/git/RIOT/examples/hello-world/bin/samr21-xpro/hello-world.bin-] {+/home/harter/work/git/RIOT/examples/hello-world/bin/samr21-xpro/hello-world.elf+}
samr30-xpro
true  -t atmel_cm0p -b -v -p -f [-/home/harter/work/git/RIOT/examples/hello-world/bin/samr30-xpro/hello-world.bin-] {+/home/harter/work/git/RIOT/examples/hello-world/bin/samr30-xpro/hello-world.elf+}

riotboot test

Test running tests/riotboot test for samr21-xpro and saml21-xpro

BOARD=samr21-xpro make -C tests/riotboot flash test

2019-03-13 15:27:51,462 - INFO # main(): This is RIOT! (Version: 2019.04-devel-475-g4af35)
2019-03-13 15:27:51,463 - INFO # Hello riotboot!
2019-03-13 15:27:51,482 - INFO # You are running RIOTmain(): This is RIOT! (Version: 2019.04-devel-475-g4af35)
2019-03-13 15:27:51,483 - INFO # Hello riotboot!
2019-03-13 15:27:51,487 - INFO # You are running RIOT on a(n) samr21-xpro board.
2019-03-13 15:27:51,491 - INFO # This board features a(n) samd21 MCU.
2019-03-13 15:27:51,494 - INFO # riotboot_test: running from slot 0
2019-03-13 15:27:51,497 - INFO # Image magic_number: 0x544f4952
2019-03-13 15:27:51,499 - INFO # Image Version: 0x00000000
2019-03-13 15:27:51,502 - INFO # Image start address: 0x00001100
2019-03-13 15:27:51,504 - INFO # Header chksum: 0x7f7aaea1
2019-03-13 15:27:51,505 - INFO # 
> curslotnr
2019-03-13 15:27:51,527 - INFO #  curslotnr
2019-03-13 15:27:51,529 - INFO # Current slot=0
> curslothdr
curslothdr
2019-03-13 15:27:51,582 - INFO #  curslothdr
2019-03-13 15:27:51,585 - INFO # Image magic_number: 0x544f4952
2019-03-13 15:27:51,587 - INFO # Image Version: 0x00000000
2019-03-13 15:27:51,590 - INFO # Image start address: 0x00001100
2019-03-13 15:27:51,592 - INFO # Header chksum: 0x7f7aaea1
2019-03-13 15:27:51,592 - INFO # 
> getslotaddr 0
getslotaddr 0
2019-03-13 15:27:51,645 - INFO #  getslotaddr 0
2019-03-13 15:27:51,647 - INFO # Slot 0 address=0x00001100
> dumpaddrs
dumpaddrs
2019-03-13 15:27:51,699 - INFO #  dumpaddrs
2019-03-13 15:27:51,703 - INFO # slot 0: metadata: 0x1000 image: 0x00001100
2019-03-13 15:27:51,707 - INFO # slot 1: metadata: 0x20800 image: 0x00000000
> 

Issues/PRs references

Split out of #8838

@cladmi cladmi added Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: tools Area: Supplementary tools Area: boards Area: Board ports CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Mar 13, 2019
@cladmi cladmi added this to the Release 2019.04 milestone Mar 13, 2019
@cladmi cladmi requested review from aabadie and dylad March 13, 2019 14:32
@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 13, 2019

@cladmi I never used riotboot yet so could you confirm it works with a second slot flash beyond the first one ?
I'll report result with saml21, saml10 and saml11.

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 13, 2019

@dylad Yeah I tested it sorry to not explain it, I will print the result here as reference.

@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 13, 2019

Maybe it is too early for SAML1X :)

make BOARD=saml11-xpro -C tests/riotboot flash 
make : on entre dans le répertoire « /home/meso/software/RIOT/tests/riotboot »
There are unsatisfied feature requirements: riotboot


EXPECT ERRORS!


Building application "tests_riotboot" for "saml11-xpro" with MCU "saml1x".

i guess it is unrelated to this PR.

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 13, 2019

Testing riotboot other commands

BOARD=samr21-xpro make -C examples/gnrc_networking flash
make -C tests/riotboot riotboot/flash-bootloader
APP_VER=1 make -C tests/riotboot riotboot/flash-slot0
APP_VER=3 make -C tests/riotboot riotboot/flash-slot1
APP_VER=2 make -C tests/riotboot riotboot/flash-extended-slot0 

And the differents steps will do:

  • It should reset the rom somehow
  • do nothing because of no images
  • boot slot 0 with version 1
  • boot slot 1 as newer with version 3
  • boot slot0 with version 2 as slot1 was discarded

And the matching make term output:

Type '/exit' to exit.
2019-03-13 16:17:42,595 - INFO # main(): This is RIOT! (Version: 2019.04-devel-475-g6a50e-pr/make/flashfile/edbg)
2019-03-13 16:17:47,660 - INFO # Hellomain(): This is RIOT! (Version: 2019.04-devel-475-g6a50e-pr/make/flashfile/edbg)
2019-03-13 16:17:47,663 - INFO # RIOT network stack example application
2019-03-13 16:17:47,666 - INFO # All up, running the shell now
> 2019-03-13 16:17:50,099 - INFO #  main(): This is RIOT! (Version: 2019.04-devel-475-g6a50e-pr/make/flashfile/edbg)
2019-03-13 16:17:50,101 - INFO # Hello riotboot!
2019-03-13 16:17:50,105 - INFO # You are running RIOT on a(n) samr21-xpro board.
2019-03-13 16:17:50,108 - INFO # This board features a(n) samd21 MCU.
2019-03-13 16:17:50,111 - INFO # riotboot_test: running from slot 0
2019-03-13 16:17:50,114 - INFO # Image magic_number: 0x544f4952
2019-03-13 16:17:50,117 - INFO # Image Version: 0x00000001
2019-03-13 16:17:50,119 - INFO # Image start address: 0x00001100
2019-03-13 16:17:50,122 - INFO # Header chksum: 0x7f7eaea2
2019-03-13 16:17:50,122 - INFO #
> 2019-03-13 16:17:50,699 - INFO #  main(): This is RIOT! (Version: 2019.04-devel-475-g6a50e-pr/make/flashfile/edbg)
2019-03-13 16:17:51,434 - INFO # Hello rmain(): This is RIOT! (Version: 2019.04-devel-475-g6a50e-pr/make/flashfile/edbg)
2019-03-13 16:17:51,435 - INFO # Hello riotboot!
2019-03-13 16:17:51,439 - INFO # You are running RIOT on a(n) samr21-xpro board.
2019-03-13 16:17:51,442 - INFO # This board features a(n) samd21 MCU.
2019-03-13 16:17:51,446 - INFO # riotboot_test: running from slot 1
2019-03-13 16:17:51,448 - INFO # Image magic_number: 0x544f4952
2019-03-13 16:17:51,451 - INFO # Image Version: 0x00000003
2019-03-13 16:17:51,454 - INFO # Image start address: 0x00020900
2019-03-13 16:17:51,456 - INFO # Header chksum: 0x6f88a6a6
2019-03-13 16:17:51,456 - INFO #
> 2019-03-13 16:17:52,611 - INFO #  main(): This is RIOT! (Version: 2019.04-devel-475-g6a50e-pr/make/flashfile/edbg)
2019-03-13 16:18:00,233 - INFO # Hello riomain(): This is RIOT! (Version: 2019.04-devel-475-g6a50e-pr/make/flashfile/edbg)
2019-03-13 16:18:00,234 - INFO # Hello riotboot!
2019-03-13 16:18:00,248 - INFO # You are running RIOT on a(n) samr21-xpro board.
2019-03-13 16:18:00,249 - INFO # This board features a(n) samd21 MCU.
2019-03-13 16:18:00,249 - INFO # riotboot_test: running from slot 0
2019-03-13 16:18:00,249 - INFO # Image magic_number: 0x544f4952
2019-03-13 16:18:00,250 - INFO # Image Version: 0x00000002
2019-03-13 16:18:00,253 - INFO # Image start address: 0x00001100
2019-03-13 16:18:00,255 - INFO # Header chksum: 0x7f82aea3
2019-03-13 16:18:00,255 - INFO #
``

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 13, 2019

@dylad yes the board should have FEATURES_PROVIDED += riotboot for using tests/riotboot. We currently whitelisted boards instead of enabling without testing :) If you put it in your board you can try if it works, but is indeed unrelated.

@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 13, 2019

We currently whitelisted boards instead of enabling without testing :)

Good idea, riotboot doesn't work at all on SAML1X right now. This is unrelated to this PR so we will skip these MCUs for now. I'll try to fix this later.

Results for SAML21-XPRO:

main(): This is RIOT! (Version: 2018.10-RC1-1737-g6a50e-pr/make/flashfile/edbg)
Hello riotboot!
You are running RIOT on a(n) saml21-xpro board.
This board features a(n) saml21 MCU.
riotboot_test: running from slot 0
Image magic_number: 0x544f4952
Image Version: 0x00000001
Image start address: 0x00001100
Header chksum: 0x7f7eaea2

> main(): This is RIOT! (Version: 2018.10-RC1-1737-g6a50e-pr/make/flashfile/edb)
Hello riotboot!
You are running RIOT on amain(): This is RIOT! (Version: 2018.10-RC1-1737-g6a50)
Hello riotboot!
You are running RIOT on a(n) saml21-xpro board.
This board features a(n) saml21 MCU.
riotboot_test: running from slot 1
Image magic_number: 0x544f4952
Image Version: 0x00000003
Image start address: 0x00020900
Header chksum: 0x6f88a6a6

> main(): This is RIOT! (Version: 2018.10-RC1-1737-g6a50e-pr/make/flashfile/edb)
Hello riotboot!
Yomain(): This is RIOT! (Version: 2018.10-RC1-1737-g6a50e-pr/make/flashfile/edb)
Hello riotboot!
You are running RIOT on a(n) saml21-xpro board.
This board features a(n) saml21 MCU.
riotboot_test: running from slot 0
Image magic_number: 0x544f4952
Image Version: 0x00000002
Image start address: 0x00001100
Header chksum: 0x7f82aea3

@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 14, 2019

All my samd21 based board use BOSSAC instead of EDBG so I cannot test on samd21 family.
Regarding SAML1X family, the bootlooader is alive but it hangs during the jump_to_slot. Dunno why yet.

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 14, 2019

@dylad making riotboot working has some dependencies, also on the cpu init so not surprising that it does not work by default

@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 15, 2019

making riotboot working has some dependencies, also on the cpu init so not surprising that it does not work by default

but SAML1X uses the same cpu_init as SAM0 so I was hoping this would work easily.

@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Mar 20, 2019
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 20, 2019

@aabadie do you have any boards you would like to test with this one

@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 23, 2019

@cladmi If you wait a bit more so we could test on SAML10 and SAML11. riotboot will be supported on these MCUs with #11248

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 24, 2019

@dylad it is not directly related as it was mainly the "flash still works" as I just added the variable name.
But if we can have this one in before Tuesday evening for the soft feature freeze, I do not mind waiting for the riotboot support :)

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 25, 2019

I added the missing test procedure that FLASHFILE can be updated from the environment.

@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 26, 2019

@cladmi could you rebased please ? I'll re-test on saml10/saml11 right away.

cladmi added 2 commits March 26, 2019 13:35
Update to use FLASHFILE as file to be flashed on the board.
It is now the case for `edbg`.
Openocd support still needs special handling.
@cladmi cladmi force-pushed the pr/make/flashfile/edbg branch from 6a50e3b to d4775cc Compare March 26, 2019 12:35
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 26, 2019

Rebased.

@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 26, 2019

Thanks @cladmi !
I can confirm SAML10-XPRO and SAML11-XPRO are now both working with this PR !
Do we need any more MCU/board to test ?

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 26, 2019

For me, if you agree with the "Test without board" that shows that flashing command is the same, it should be good with this.

Copy link
Copy Markdown
Member

@dylad dylad left a comment

Choose a reason for hiding this comment

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

ACK.

@dylad dylad added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines labels Mar 26, 2019
@dylad dylad merged commit a778568 into RIOT-OS:master Mar 26, 2019
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 26, 2019

Thank you for the review, almost no hack anymore for riotboot !

@cladmi cladmi deleted the pr/make/flashfile/edbg branch March 26, 2019 15:14
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 26, 2019

Oh I just noticed this changed the rule for flashing slot0 for openocd… must have been a rebase mistake at some point on my side while working on both. I should re-read the github output from time to time…

@emmanuelsearch @bergzand @kYc0o should I provide a fix for this one quickly or do you think #11254 is ready/tested enough to get through ?

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 26, 2019

Hmm it is still working but only by luck because of the hack ELFFILE = $(FLASHFILE) in tests/riotboot but would not if it was not set for the hack to have make flash working with it.

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 26, 2019

I put the fix for this issue only in #11284 and also introduced the fixing commit in #11254

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: build system Area: Build system Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants