I try to find a good procedure to compile firmware with GCC.
Each time we need to add some firmeware code, we need to modify memory layout.
After some reading on the web and the Porting Kit documentation, it's not very clear for me.
When I cannot build because my firmware doesn't fit the allocated memory, I need to change two files :
C:\MicroFrameworkPK_v4_1\Solutions\Netduino\TinyCLR>scatterfile_tinyclr_gcc.xml
and
C:\MicroFrameworkPK_v4_1\Solutions\Netduino\DeviceCode\Blockstorage\Sam7X_blockstorage
For the first, it's simple, if I understand correctly :
If I need x bytes (compiler give this value), I just need to add x to previous existing value in Deploy_BaseAddress properties.
<?xml version="1.0"?> <ScatterFile xmlns="http://schemas.microsoft.com/netmf/ScatterfileSchema.xsd"> <!-- SAM7X512 has 128KB of RAM at 0x00000000, 512KB FLASH at 0x00100000 --> <Set Name="Valid" Value="false"/> <!-- ################################################################################ --> <!-- 16KB Stack and 16KB Heap --> <Set Name="Heap_Begin" Value="0x00010000"/> <Set Name="Heap_End" Value="0x00017FF8"/> <Set Name="Stack_Bottom" Value="0x00018000"/> <Set Name="Stack_Top" Value="0x0001FFF8"/> <If Name="TARGETLOCATION" In="FLASH"> <Set Name="Code_BaseAddress" Value="0x0011e000"/> <Set Name="Deploy_BaseAddress" Value="0x00172000"/> <!-- here --> <Set Name="Code_Size" Value="%Deploy_BaseAddress - Code_BaseAddress%"/> <Set Name="Config_BaseAddress" Value="0x0017E000"/> <Set Name="Config_Size" Value="0x00002000"/> <Set Name="Valid" Value="true"/> </If>
With this modification, the compile phase should works. But, the deployement phase can be unsuccessful in case of not enought room in blockstorage.
So, we need to change values in this structure also.
const BlockRange g_SAM7X_BS_BlockRange[] = { // { BlockRange::BLOCKTYPE_BOOTSTRAP , 0, 5 }, { MEMORY_BLOCKTYPE_GCC_SPECIAL_BOOTSTRAP, 6, 14 }, { BlockRange::BLOCKTYPE_CODE , 15, 44 }, { MEMORY_BLOCKTYPE_GCC_SPECIAL_CODE , 45, 46 }, { BlockRange::BLOCKTYPE_DEPLOYMENT , 47, 60 }, { BlockRange::BLOCKTYPE_STORAGE_A , 61, 61 }, { BlockRange::BLOCKTYPE_STORAGE_B , 62, 62 }, { BlockRange::BLOCKTYPE_CONFIG , 63, 63 } };
Anybody may explain how to modify this file with a easy to understand way. How to know the size of each block ?
Is it related to PortBooter.bin, TinyBooter.bin, TinyBooterDecompressor.bin files size (one block = 8k) ...
Any help appreciate,
/pascal