Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

where 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.

  1. Right click your system library and select Properties

  2. Select C/C++ Build from the left hand panel of the Properties window

  3. Under Tool Settings select Preprocessor under Nios II Compiler

  4. Define a new symbol called ALT_USE_CFI_FLASH in the Defined Symbols window

  5. Select OK

  6. Recompile your project

In step 3 "Tool Settings" is not present in the window. So my question is where/how do I define ALT_USE_CFI_FLASH?

I am using 9.1SP2

Thanks,

John

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored 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's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for the tip, I was able to reduce the code size from 11k to 7180 using -Os. That should work.