Forum Discussion
Altera_Forum
Honored Contributor
15 years agowhere do I define ALT_USE_CFI_FLASH
I am trying to enable writing to flash, but alt_flash_open_dev(CFI_FLASH_NAME) is returning NULL due to the following line of code# if (!defined(ALT_EXCLUDE_CFI_FLASH) && ((!defined(ALT_USE_SMALL_DRIVERS) && !defined(ALT_SIM_OPTIMIZE)) || defined(ALT_USE_CFI_FLASH)))
in altera_avalon_cfi_flash.h If I uncheck enable_reduced_device_drivers in the BSP editor, the function works, but the code size is increases by 9k. This will not work since I have to fit the code in the boot loader section that is only 8k. I have found support solution rd04202006_176, but the steps do not make sense.- Right click your system library and select Properties
- Select C/C++ Build from the left hand panel of the Properties window
- Under Tool Settings select Preprocessor under Nios II Compiler
- Define a new symbol called ALT_USE_CFI_FLASH in the Defined Symbols window
- Select OK
- Recompile your project
3 Replies
- Altera_Forum
Honored Contributor
I found it, in 9.1sp2 it is:
properties->nios ii bsp properties. There is a field called defined symbols. I just added "-DALT_USE_CFI_FLASH" The code size is still 9K larger, which I find odd. I guess I will have to have more memory allocated. John - Altera_Forum
Honored Contributor
Make sure you are optimising the code -O2, -O3 or -Os
- Altera_Forum
Honored Contributor
Thanks for the tip, I was able to reduce the code size from 11k to 7180 using -Os. That should work.