Hello. I'm having some doubts about what i need to to do in order to use the progmem space with sketches over 64kb.
My question isn't really how to use it, it's if i need to change things everywere or just is some places.
As an example:
I have a sketch that is almost going over 64K. I use macros like F() and PSRT() a lot, which as far as i know can only work for the lower progmem space.
I also have a very big library which also uses F() and PSRT() everywere.
My problem is that when I compile the project, i have no idea where each part of the code will end up in the memory... Do I have any way of ensuring that all my libraries will end up on the lower progmem space? So that I only need to deal with the addresses > 64 on the main code?
Do I have any way of ensuring that all my libraries will end up on the lower progmem space?
No.
So that I only need to deal with the addresses > 64 on the main code?
You should look at the intermediate files that are produced during the compile process. See if you can identify where libraries are involved or where "the main code" (whatever that means) is involved. In the end, you can't.
Ok thank you for the quick reply. I guess it wasn't very clear, when i said "main code" i meant the code written in the Arduino ide and not in the libraries folder.
I guess it doesn't really matter much where the files actually are as long as the compiler can find them... But since i don't really know much about how the linking process works, I wondered if there was some kind of way to force the order of the data in the hex file.
WIll try going through the files like you said and see if I can make sense of it.
The compiler doesn't see a difference between code in a cpp file in a directory with libraries in the name and the code the in a cpp file that is in a path that does not contain libraries in the name.
So, first thing you need to do is get over thinking that libraries are somehow magic or exempt from any rules.
But since i don't really know much about how the linking process works, I wondered if there was some kind of way to force the order of the data in the hex file.
The data is already ordered. There are code sections, data sections, etc. All code goes in the code section, whether it came from a sketch or a library. All data goes in the data section, regardless of whether it came from a sketch or a library or the man in the moon.
If you need to deal with data crossing the 64K mark, you need to do it in ALL the code.