Products > Programming

GCC ARM32 32F417 how to call or jump to a specific address?

<< < (8/9) > >>

ataradov:
I understand you perfectly and saying that you are wrong. If you put an arbitrary standalone project binary into the second part, but skip the reset handler, what code would be initializing the global variables for that code? You main boot program can't do that  because it does not know anything about that binary. So, if you jump into the main() directly, all your BSS memory would not be zeroed out and initialized memory would not  be initialized.

SP is less critical, but it is still a good idea to give control over it to the application. It might not want to have it at the end of SRAM. The binary may want to reserve some SRAM at the end.

peter-h:
Indeed, any development environment which generates just the "overlay" would have code in main() which sets up the BSS and the initialised statics.

I had the same issue with the boot loader. There, it was done in C:


--- Code: --- extern char _loader_start;
extern char _loader_end;
extern char _loader_loadaddr;
extern char _loader_bss_start;
extern char _loader_bss_end;

// Copy loader code to RAM. This also sets up its initialised data.
B_memcpy(&_loader_start, &_loader_loadaddr, &_loader_end - &_loader_start);

// Clear loader's BSS and COMMON
B_memset(&_loader_bss_start, 0, &_loader_bss_end - &_loader_bss_start);

extern void loader_entry() __attribute__((long_call));
loader_entry();

// never get here (loader always reboots)
for (;;);
--- End code ---

ataradov:

--- Quote from: peter-h on June 14, 2022, 06:29:33 pm ---Indeed, any development environment which generates just the "overlay" would have code in main() which sets up the BSS and the initialised statics.

--- End quote ---
But why? All the reset handler is doing is this initialization and a call to main, except if you instruct people to place main() a a reset vector, you will also have to explain to them rules for BSS and data initialization and have them copy the code from the reset handler. And all you had to do to avoid all this is literally do nothing. Just keep the reset handler in the vector table and everything will work with standard environments.

All you have here is a standard bootloader, just behave like normal bootloaders behave and people will have no issues using your stuff. But you are inventing something that would be confusing to anyone familiar with how any of this works.

peter-h:
A development environment which builds just the overlay would be the same as my current one, minus the boot block.

ataradov:
Why are you mandating the development environment? Why not let user pick what they want to do?

Anyway, do whatever you want, I'm not going to be the user, and that makes me happy.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version