Showing results for 
Search instead for 
Did you mean: 
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

U-boot config

U-boot config

Customize the u-boot config file, my_nios2.h,

1. sysid If you don't have sysid, comment out the line,


2. serial console If you use jtag uart, comment out the line, and add jtag uart define.

/* #define CONFIG_ALTERA_UART */


3. status led a. If you don't have status led, comment out the three lines,

/* #define CONFIG_STATUS_LED */ /* Enable status driver */

/* #define CONFIG_GPIO_LED */ /* Enable GPIO LED driver */

/* #define CONFIG_GPIO */ /* Enable GPIO driver */

b. If you use led drived by Altera PIO core, and the instance name is not LED_PIO, add a define,


eg. EP3C120 board, #define LED_PIO_BASE USER_LED_PIO_8OUT_BASE


c. change STATUS_LED_BIT to the bit position in the LED port. eg,

#define STATUS_LED_BIT 2 /* bit 2 in the LED port */

4. enviroment variable CONFIG_ENV_SIZE must be at least one flash erase sector size. It was 64k for older nios2 dev board, such as 1c20, 1s10, 1s40, and 2c35. It is 128k for newer 3c120 and neek.

a. if you save env in cfi flash


CONFIG_ENV_ADDR may be set to right after u-boot in the flash, or at the last sector of the flash, or other free space in the flash. You may need to adjust CONFIG_ENV_ADDR , like NEEK.h for NEEK.

b. if you save env in epcs/spi flash,


# define CONFIG_ENV_OFFSET 0x7e0000 /* last sector */

# define CONFIG_ENV_SIZE 0x20000 /* 1 sector */

# define CONFIG_ENV_SECT_SIZE 0x20000


# define CONFIG_ENV_SPI_CS 0

# define CONFIG_ENV_SPI_MAX_HZ 30000000 /*30Mhz */

c. if you save env in nand flash,


# define CONFIG_ENV_OFFSET 0x40000

# define CONFIG_ENV_SIZE 0x40000 /* 1 sector */

d. if you don't want to save env,

# define CONFIG_ENV_IS_NOWHERE 1 /* if env in SDRAM */

# define CONFIG_ENV_SIZE 0x20000

5. memory If you use FAT on IDE or MMC/SD, or UBI on flash, you should reserve more space,

#define CONFIG_SYS_MONITOR_LEN 0x80000 /* Reserve 512k , text+data+bss */

#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 0x80000) /* 512k, malloc */

But env addr can be set to offset 256k, enogh size for text+data without bss, as you don't write bss to flash.


0x40000) | \


6. auto boot If you want u-boot to start linux automatically, add this line,


7. if you have more than one uart or timer in system, they will be unified to the same name by sopc-create-config-files. It will cause compilation error. Please rename the unused one in my_nios2_fpga.h. The example design of Altera dev boards come with nios2eds have such issue in two timers.

Version history
Last update:
‎06-26-2019 02:07 AM
Updated by: