3 ms·
That one confounded us for a while. There was no true parallelism going on in the system but the code that needed nop padding was the interrupt handler. That
by mark_undoio 4y ago
That one confounded us for a while. There was no true parallelism going on in the system but the code that needed nop padding was the interrupt handler.
That it needed padding wasn't unreasonable - we had tight timing constraints. It would have absolutely made sense for it to race with another part of the system but that didn't seem to be the nature of the interaction. The interrupt handler could always run when it wanted to.
The eventual deduction: the flash memory had 256 byte pages at hardware level. I inferred that there's some initial access cost to open a page (and probably cache it into SRAM or something).
The build was putting later functions in the file at later addresses, so what you put in other functions changed the alignment of the interrupt handler. If you requested 256 byte alignment for that function then you still needed nop padding but it was completely consistent.