AGlass0fMilk / mbed-mcuboot-demo

Demo of mcuboot with Mbed
11 stars 15 forks source link

This example/demo fails to build #2

Closed douardda closed 3 years ago

douardda commented 4 years ago

I've noticed a few problems in this demo repo, as discussed on https://github.com/JuulLabs-OSS/mcuboot/pull/791

once these are fixed, I also have a weird error:

[mbed] Working path "/home/david/perso/embed/mbed/mbed-mcuboot-demo" (program)
[Warning] @,: Compiler version mismatch: Have 7.3.1; expected version >= 6.0.0 and < 7.0.0
Building project mbed-mcuboot-demo (NUCLEO_F411RE, GCC_ARM)
Scan: mbed-mcuboot-demo
Using ROM regions application, post_application in this build.
  Region application: size 0x20000, offset 0x8000000
  Region post_application: size 0x60000, offset 0x8020000
Compile [  0.3%]: enc_key.c
Compile [  0.6%]: default_bd.cpp
Compile [  0.9%]: BME680_BSEC.cpp
Compile [  1.2%]: bme680_selftest.c
Compile [  1.5%]: BME680.cpp
[Fatal Error] ThisThread.h@26,10: cmsis_os2.h: No such file or directory
[ERROR] '_queue.SimpleQueue' object has no attribute 'queue'
[mbed] ERROR: "/home/david/.virtualenvs/mbed/bin/python3" returned error.
       Code: 1
       Path: "/home/david/perso/embed/mbed/mbed-mcuboot-demo"
       Command: "/home/david/.virtualenvs/mbed/bin/python3 -u /home/david/perso/embed/mbed/mbed-mcuboot-demo/mbed-os/tools/make.py -t GCC_ARM -m NUCLEO_F411RE --source . --build ./BUILD/NUCLEO_F411RE/GCC_ARM -c"
       Tip: You could retry the last command with "-v" flag for verbose output
---

which I don't undertand.

Trying with a target suggested in the README, I have another kind of error :

mbed-mcuboot-demo$  mbed compile -t GCC_ARM -m NRF52840_DK  -c
[mbed] Working path "/home/david/perso/embed/mbed/mbed-mcuboot-demo" (program)
[Warning] @,: Compiler version mismatch: Have 7.3.1; expected version >= 6.0.0 and < 7.0.0
Building project mbed-mcuboot-demo (NRF52840_DK, GCC_ARM)
Scan: mbed-mcuboot-demo
Using ROM regions application, post_application in this build.
  Region application: size 0x20000, offset 0x0
  Region post_application: size 0xe0000, offset 0x20000
No Linker Script found
Could not compile for NRF52840_DK: No Linker Script found
[mbed] ERROR: "/home/david/.virtualenvs/mbed/bin/python3" returned error.
       Code: 1
       Path: "/home/david/perso/embed/mbed/mbed-mcuboot-demo"
       Command: "/home/david/.virtualenvs/mbed/bin/python3 -u /home/david/perso/embed/mbed/mbed-mcuboot-demo/mbed-os/tools/make.py -t GCC_ARM -m NRF52840_DK --source . --build ./BUILD/NRF52840_DK/GCC_ARM -c"
       Tip: You could retry the last command with "-v" flag for verbose output
---
douardda commented 4 years ago

for good measure, here the content of my mbed venv:

$ python --version
Python 3.7.3

$ pip list
Package            Version
------------------ -----------
appdirs            1.4.4
asn1ate            0.6.0
asn1crypto         1.4.0
beautifulsoup4     4.6.3
cbor               1.0.0
certifi            2020.6.20
cffi               1.14.2
chardet            3.0.4
Click              7.0
cmsis-pack-manager 0.2.10
colorama           0.3.9
cryptography       3.1
ecdsa              0.16.0
fasteners          0.15
future             0.16.0
icetea             1.2.4
idna               2.7
imgtool            1.7.0a1
intelhex           2.2.1
Jinja2             2.10.3
jsonmerge          1.7.0
jsonschema         2.6.0
junit-xml          1.8
lockfile           0.12.2
manifest-tool      1.5.2
MarkupSafe         1.1.1
mbed-cli           1.10.4
mbed-cloud-sdk     2.0.8
mbed-flasher       0.10.1
mbed-greentea      1.7.4
mbed-host-tests    1.5.10
mbed-ls            1.7.12
mbed-os-tools      0.0.15
milksnake          0.1.5
monotonic          1.5
pip                20.2.2
pkg-resources      0.0.0
prettytable        0.7.2
protobuf           3.5.2.post1
psutil             5.6.2
pyasn1             0.2.3
pycparser          2.20
pycryptodome       3.7.3
pyelftools         0.25
pyparsing          2.4.7
pyserial           3.4
python-dateutil    2.8.1
python-dotenv      0.14.0
pyusb              1.0.2
PyYAML             4.2b1
requests           2.20.1
semver             2.10.2
setuptools         50.0.0
six                1.12.0
soupsieve          2.0.1
urllib3            1.24.2
wheel              0.35.1
yattag             1.14.0
douardda commented 4 years ago

Also the referenced https://github.com/EmbeddedPlanet/ep-oc-mcu lib seems to be for mbed 6 (uses AnalogIn,read_voltage()).

Current master is better since it includes your PR to be BWcompat with mbed 5, but this later PR (https://github.com/EmbeddedPlanet/ep-oc-mcu/pull/33) is incomplete since there are a few adc_in.read() that should be replaced with adc_in->read() in ResistorDivider.cpp

see https://github.com/EmbeddedPlanet/ep-oc-mcu/pull/35

Note that with this PR I've been able to compile the demo code for the NUCLEO_F411RE target (not checked it runs however :-) )

Forgot to mention I also had to use the latest mbed 5 (5.15.5) to be able to compile the demo.

douardda commented 4 years ago

Quick followup: I've been able to compile (without serial support) for a Nucleo L432KC and upload the firmware (my F411RE seems to be dead) and the led does blink. Not sure how to check the mcuboot fw upgrade without support for the upgrade-over-serial.

AGlass0fMilk commented 4 years ago

Sorry I didn't see this on my feed for some reason... I will review.

AGlass0fMilk commented 4 years ago

So the first error I think is caused by the baremetal profile in Mbed OS 5. In Mbed OS 6 the rtos::ThisThread APIs are available by default since this is the recommended way to do things like sleep_for, delay, etc. In Mbed OS 5 I don't think this is the case. The build would go fine since the declarations in ThisThread.h were there but then there would be missing symbols. This part of your issue should be resolved by #4 by the addition of rtos-api to the "requires" list here: https://github.com/AGlass0fMilk/mbed-mcuboot-demo/blob/1e8a8897a4720719ec93f05b1add010880220ffe/mbed_app.json#L2

I am not experiencing the second issue you mentioned -- not being to find the linker script for the nRF52840_DK target. I checked my pip list and have the same mbed tools versions as you. Maybe your configuration is messed up somehow? I would try a clean clone perhaps.

You may need to update your GCC ARM toolchain though. The current version support by Mbed OS is 9.2.1 I believe:

arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]

I hope this helps you test out the mcuboot demo further on your STM target! Thanks for the feedback and PRs, they're greatly appreciated.

AGlass0fMilk commented 3 years ago

@douardda is this still an issue? The demo has been improved extensively (and the SerialOTA stuff has been removed) and the mbed-os port of mcuboot has been officially merged into mcuboot master.

Please try again and let me know if you encounter any issues.

douardda commented 3 years ago

I'll give a try ASAP

AGlass0fMilk commented 3 years ago

Hi @douardda, I will close this issue for now. If you eventually have issues when you revisit this please reopen this issue or start a new one.

Thanks!