Forum Discussion
Altera_Forum
Honored Contributor
19 years agoIn case this helps anyone else out, I did end up getting my project to fit inside of a 10kB block, as opposed to the 52kB or so that it was bloating into previously. Here are a few of the steps that I followed:
1. I ended up building a new Nios project using the "memory test" template (instead of the "blank" template). This was per a suggestion by an Altera FAE that maybe the blank template would instantiate (and compile) all possible code that could be used (as opposed to just what would be needed for a UART-based memory test program), thus increasing the size. I can't say w/ any certainty whether or not this actually effected the size or not. 2. I replaced all references to printf() and getchar() with alt_printf() and alt_getchar(). The catch here being that these are light-weight versions of the bona-fide C function calls, and I had to make modifications to my code to account for this. The alt_printf() only has a few variable substitutions that can be made (most of my changes had to do with this), while I did not have to make any modifications to alt_getchar(). So those where the two major changes that I made, which then allowed me to check "lightweight device driver API", and giving me the small footprint. Now that I look back at the project settings, it did not require me to select "small C library" in order to get the reduced size. The SOPC project used the following peripherals: cpu_0 (Nios II/e w/ level 1 debug) onchip_memory (16k) uart_0 various parallel I/O (pio) Hope this helps anyone else that might be having the same problem. Jeff