Re:What happens before main() is executed in C and why is it...
by 2RTZZSro on Friday May 04, 2018 @02:14PM
(#16996846)
What was the project for where you wrote code that self-detected its boot location?
[ Parent
| on HN ]
Re:What happens before main() is executed in C and why is it...
by RealityVoid on Friday May 04, 2018 @03:03PM
(#16997307)
Well, a bootloader and the self-detection was useful for the bootloader self-update. The update bootloader would be copied in a different section and on reset would start and copy itself over the original bootloader section.
I also wanted to maintain full functionality even at shifted location in case the self-copy process somehow failed. Never did fail, at least to my knowledge.