Re:What happens before main() is executed in C and why is it...
by barbegal on Friday May 04, 2018 @01:39PM
(#16996493)
Most manufacturers do in broad terms disclose how the boot sequence works. Here is an example of the information disclosed about a Cypress microcontroller [1]. In some applications the startup time can be critical so this needs to be known. The code that runs before the engineers code doesn't usually have any effect and it puts the microcontroller into a known documented state so you don't really need to think about it.
[1] https://community.cypress.com/community/psoc-6/blog/2017/05/...
Re:What happens before main() is executed in C and why is it...
by monocasa on Friday May 04, 2018 @01:56PM
(#16996677)
It depends heavily on the SoC in question. On an unlocked STM32F4, you can attach JTAG pretty much immediately even if it's way off in the weeds executing garbage, but BCM283x (RPi) has to setup the pinmux for the JTAG first from the ARM core, so you have to already be running some of your own code.
I had a lot of curiosity about how JTAG works and how I can build my own debugger for general targets, but is seems documentation for this is thin. I should look over openocd to see how those guys are doing stuff.