Just thought this information could be useful to someone who want to use snes-sdk and will have the same problem I had, and solved with help of mic and Chilly Willy.
The tcc816 from the snes-sdk is a nice C compiler, but currently it has few problems that could be a real showstopper for any large project (say, just a full screen picture and music).
First problem, rather obvious, is that one piece of data can't be larger than 32K. So if you have a data array that is larger than 32K, you need to split it to few smaller arrays.
Second problem. Compiler puts data into .data section regardless of const. When this section overflows, linker tell you there is no room in .data. You can fix this with a custom tool that will move all the const data to .rodata section. mic made such a tool (source code only), but you may need to change it a bit if you have different data organization in your program.
Third problem. Even with the tool, when you have total amount of const data >32K, you'll get a linker error that there is no room in .rodata now. The problem is neither the compiler nor linker are allocate data into ROM banks automatically. You have do to it by yourself, creating .rodata1, .rodata2 etc sections and putting no more than 32K of data in every .rodata section. You can do it either by creating a custom tool, or by declaring additional .rodata sections in a separate assembly file, including the data with incbin and referencing to the data from C code through extern.
The tcc816 from the snes-sdk is a nice C compiler, but currently it has few problems that could be a real showstopper for any large project (say, just a full screen picture and music).
First problem, rather obvious, is that one piece of data can't be larger than 32K. So if you have a data array that is larger than 32K, you need to split it to few smaller arrays.
Second problem. Compiler puts data into .data section regardless of const. When this section overflows, linker tell you there is no room in .data. You can fix this with a custom tool that will move all the const data to .rodata section. mic made such a tool (source code only), but you may need to change it a bit if you have different data organization in your program.
Third problem. Even with the tool, when you have total amount of const data >32K, you'll get a linker error that there is no room in .rodata now. The problem is neither the compiler nor linker are allocate data into ROM banks automatically. You have do to it by yourself, creating .rodata1, .rodata2 etc sections and putting no more than 32K of data in every .rodata section. You can do it either by creating a custom tool, or by declaring additional .rodata sections in a separate assembly file, including the data with incbin and referencing to the data from C code through extern.