Question about -mcog and code size
Retrobits
Posts: 46
Newbie alert :-)
If I read it right, programs generated with the COG memory model (-mcog) are supposed to run within a cog, with speed/size benefits, if your code is small enough to fit in < 2K.
The trouble I'm having is that even a program that does nothing - with an empty main() function - still gives me an elf file that is 2207 bytes.
I understand -mcog puts data into hub RAM, but in this case, there is no data at all, so I'm assuming it's all executable.
I'm using:
propeller-elf-gcc -mcog -Os -o test.elf test.c
Is some of the executable size bootstrap code, and actually, this really fits? I don't know the architecture of the executable or what it contains, so it could be misleading me. Also, is there an error message generated if your code is too big to fit into the memory model you've selected, or does that happen at load time?
Thanks for help out a newcomer,
- Earl
If I read it right, programs generated with the COG memory model (-mcog) are supposed to run within a cog, with speed/size benefits, if your code is small enough to fit in < 2K.
The trouble I'm having is that even a program that does nothing - with an empty main() function - still gives me an elf file that is 2207 bytes.
I understand -mcog puts data into hub RAM, but in this case, there is no data at all, so I'm assuming it's all executable.
I'm using:
propeller-elf-gcc -mcog -Os -o test.elf test.c
Is some of the executable size bootstrap code, and actually, this really fits? I don't know the architecture of the executable or what it contains, so it could be misleading me. Also, is there an error message generated if your code is too big to fit into the memory model you've selected, or does that happen at load time?
Thanks for help out a newcomer,
- Earl
Comments
All is well!
- Earl
While -s does give a closer approximation of image size, it can also disable variable stuffing functionality of propeller-load.
SimpleIDE calculates the actual code and data size of a program without using -s and displays it on the bottom left panel.
Propeller-load also gives the actual code size on load as well as with the binary conversion method you mentioned.