Skip to content

OTA on M4 #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yann-l opened this issue Nov 1, 2021 · 10 comments
Open

OTA on M4 #15

yann-l opened this issue Nov 1, 2021 · 10 comments

Comments

@yann-l
Copy link

yann-l commented Nov 1, 2021

Hello,

Is there a way to update flash for M4 core with this OTA library?

Maybe using the _data_offset parameter of the Arduino_Portenta_OTA_QSPI constructor? But which value to use when flash repartition is 1MB per core? (By the way, why 2 us used in the example for the M7 core?)

Or maybe something like M7 core connects to wifi, downloads the M4 ota file to QSPI, then use an RPC call so that M4 core finishes the process to update its flash?

@SamMartin4242
Copy link

Anyone ever figure this out?

@megacct
Copy link

megacct commented Dec 17, 2024

same question here. I'm trying the method mentioned by @yann-l above

"Or maybe something like M7 core connects to wifi, downloads the M4 ota file to QSPI, then use an RPC call so that M4 core finishes the process to update its flash?"

with M7 doing download and M4 setting the RTC_BKP_ registers before M7 does a reset. M4 sketch does not get applied.

Is it technically possible or are we wasting our time? Thanks

@pennam
Copy link
Contributor

pennam commented Dec 17, 2024

Yes it is technically possible, but only using the 1:1 flash split because in the bootloader there is an hardcoded offset. Using #40

you need to create and M4 binary and process it with compression and bintoota like any other M7 file
download the file on QSPI with M7
write RTC registers like a standard M7 OTA
reboot
If the binary file is formatted correctly the bootloader will recognize that is for the M4 and start flashing the binary at the correct offset.

https://github.com/arduino/mcuboot-arduino-stm32h7/blob/370dce28b648aea24b7ae2a0f685a59e5439f672/app/ota/ota.cpp#L49

@megacct
Copy link

megacct commented Dec 17, 2024

@pennam Thank you so much for responding, and especially including the link. I am running this OTA on a GIGA R1 - and I am guessing the reason it isn't working is that my bootloader isn't capable - please confirm. If so, can the GIGA run the MCUboot? maybe with a few tweaks? or is the board incompatible? Regards

@pennam
Copy link
Contributor

pennam commented Dec 17, 2024

@megacct it is the default bootloader for the giga. It acts as a "stadard" arduino bootloader if you not configure the keys, but OTA feature is supported in both modes "standard" and "mcuboot".

@megacct
Copy link

megacct commented Dec 17, 2024

@pennam darn it! thought I had spotted the problem with GIGA being absent from the supported boards in the mcuboot readme. I'm at a loss. I'm doing everything as described above (even tried using ota.init() ota.update in the M4 rather than just setting the registers. Low priority, but if someone could test this approach on a GIGA with latest code I'd appreciate it. Thanks

@pennam
Copy link
Contributor

pennam commented Dec 17, 2024

thought I had spotted the problem with GIGA being absent from the supported boards

my fault I have to update the docs...

I need to find some time to re-create the setup and test it. Can't tell you a date, but i will try to do it!

@megacct
Copy link

megacct commented Dec 17, 2024

@pennam Thanks. It's a nice-to-have feature but as my M4 will be serving as a black-box record for the M7 it shouldn't need the frequency of updates that the main core will.

@megacct
Copy link

megacct commented Dec 17, 2024

@pennam sorted! I turned on debug and got this for an M4 OTA

I-Starting Arduino bootloader
I-Secure keys not configured
I-Booting sketch at 0x8040000

compared to this for an M7

I-Starting Arduino bootloader
I-Secure keys not configured
I-Start OTA 0xA4 0x2 0x9607C
I-Sketch updated
I-Starting Arduino bootloader
I-Secure keys not configured
I-Booting sketch at 0x8040000

I had the ota.update() / register settings being done in the M4. When I moved them to M7 I got this

I-Starting Arduino bootloader
I-Secure keys not configured
I-Start OTA 0xA4 0x2 0x40633
I-Sketch updated
I-Starting Arduino bootloader
I-Secure keys not configured
I-Booting sketch at 0x8040000

This is the ideal result as I don't have any OTA code in my black-box.
Thanks for your assistance (especially that repo link)

@pennam
Copy link
Contributor

pennam commented Dec 17, 2024

Great! Happy you have solved! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants