News for hackers. Stuff that matters.
Re:Modern C by brandmeyer on Friday September 04, 2020 @01:36PM (#24377078)
> (zero the BSS, setup the stack, jump main)

Also: run global initializers. Getting kinda fuzzy on the boundaries, but I'd also add in the process to copy the initial contents of the .data segment from read-only to read-write storage.

Re:Modern C by tomjakubowski on Friday September 04, 2020 @02:09PM (#24377425)
In standard C only constant values can initialize globals, so the value can be baked into the binary.
Re:Modern C by brandmeyer on Friday September 04, 2020 @06:30PM (#24379536)
"baked into the binary" covers a lot of ground. You've got to get the initial contents of .data initialized somehow. In a typical microcontroller that's a copy from flash to ram.
Re:Modern C by simias on Saturday September 05, 2020 @07:15AM (#24382777)
That's true, I forgot about that because the last controller I used had a bootrom that copied the booloader straight to RAM, so .data was already read-write and there was nothing to do.