128 KB program in AVR128DB flash? #137
-
Can I write a program up to 128 KB or is the maximum program size still only 32 KB with the rest reserved for PROGMEM? If I can write more than 32 KB, does the compiler handle the details of that for me behind the scenes, or will I need to manually break up the code into 32 KB banks somehow? If the code can be larger, what happens if the currently executing code is at, say, offset 100 KB into the flash, but tries to access PROGMEM at offset 40 KB? Or, what happens if it needs to branch from flash 110 KB to 50 KB? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Okay, it looks like the answers are:
|
Beta Was this translation helpful? Give feedback.
-
This is correct, instructions to be executed are read directly from flash and the 16 bit program counter allows for flash up to 128k because it;s word addressed.. The 32k segment limit only applies to reading from progmem using LD/ST, (mapped progmem) from the application.(we have a hacky trick to put variables in there described in the readme somewhere, and you can then read them like they were normal variables (though not write them, generally). Note that I don't think you save any time with this - I think it's more a matter of convenience and gracefulness) LD is 1 clock faster than LPM, but if you read the instructionset manual they say a minimum of 1 extra clock is needed to address stuff in mapped progmem, and refer to the datasheet for specifics, but I've read the relevant sections many times looking for the documentation of that and found nothing. So I think only the 1 clock minimum added execution time applies. |
Beta Was this translation helpful? Give feedback.
Okay, it looks like the answers are: