Skip to content
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

add file @specified address to uf2 #1300

Closed
underhood opened this issue Mar 4, 2023 · 5 comments
Closed

add file @specified address to uf2 #1300

underhood opened this issue Mar 4, 2023 · 5 comments

Comments

@underhood
Copy link

underhood commented Mar 4, 2023

Hello, I somehow seem to fail at googling this.

What is the proper way to add arbitrary binary data to the uf2 image to be flashed.
What imagine is something like:

  • add contents of a file "a.bmp" at address 1MB from flash start

so that this file is flashed together with firmware and then I can access it by something like
const char *bitmap = (char*)XIP_BASE + 1024*1024

or ideally that address offset would even be defined as some named symbol in C source (instead of calculating it)

@lurch
Copy link
Contributor

lurch commented Mar 5, 2023

See #1071 and #1074 ?

@kilograham
Copy link
Contributor

  1. simplest way to add image into your binary, is to use xxd -i to generate a C header
  2. you can also mess with objcopy and friends to create a .o(bj) file you can include in your link
  3. finally you can use picotool to load a separate binary
  4. there is no UF2 tool i can see to combine two files (but you could make one in python relatively easily).

It sounds like in your use case you want 1 (since you just want it embedded anywhere) (or 2)

@underhood
Copy link
Author

underhood commented Mar 6, 2023

@kilograham Thank you for reply the 1. would not work for my use case as I can not specify the exact location of the data on the flash. Reason I want to add file X at 1MB boundary in the flash is later I want the runtime to rewrite that location using the flash API. Therefore I wanted it to be at exact location and away from rest of the binary.

I will investigate the other options given here as comments as they seem viadble.

@peterharperuk
Copy link
Contributor

Why 1MB? Wouldn't 1 page be enough? This issue discusses an interesting technique for "reserving" an area in flash that you can update later #1278

@underhood
Copy link
Author

underhood commented Mar 6, 2023

Well it (address being 1MB from start of flash) is mostly an example but idea was: The program itself is not expected to grow over 1MB so that kind of nice (round) place to put it

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