### BSP Description

BSP Type: | hal2
SOPC Design File: |
Quartus JDI File: | default
CPU: | intel_niosv_m
BSP Settings File: | D:\dev_2025\a3sk_revB\A3CZ135BB18AE7S-cd-rom-25.1\Demonstrations\sdcard_filesystem\software\nios_bsp\settings.bsp
BSP Version: | default
BSP Generated On: | 2025年6月17日 下午4:29:19
BSP Generated Timestamp: | 1750148959499
BSP Generated Location: | D:\dev_2025\a3sk_revB\A3CZ135BB18AE7S-cd-rom-25.1\Demonstrations\sdcard_filesystem\software\nios_bsp

### Nios V Memory Map

Slave Descriptor | Address Range | Size | Attributes
--- | --- | --- | ---
jtag_uart | 0x000910B8 - 0x000910BF | 8 | printable
sysid_qsys | 0x000910B0 - 0x000910B7 | 8 |
sd_dat | 0x000910A0 - 0x000910AF | 16 |
sd_cmd | 0x00091090 - 0x0009109F | 16 |
sd_clk | 0x00091080 - 0x0009108F | 16 |
pio_led | 0x00091070 - 0x0009107F | 16 |
pio_key | 0x00091060 - 0x0009106F | 16 |
timer | 0x00091040 - 0x0009105F | 32 | timer
intel_niosv_m_timer_sw_agent | 0x00091000 - 0x0009103F | 64 |
terasic_sdcard | 0x00090000 - 0x00090FFF | 4096 |
intel_niosv_m_dm_agent | 0x00080000 - 0x0008FFFF | 65536 |
intel_onchip_memory | 0x00000000 - 0x0007CFFF | 512000 | memory

### Linker Regions

Region | Address Range | Size | Memory | Offset
--- | --- | --- | --- | ---

### Linker Section Mappings

Section | Region
--- | ---
.text | intel_onchip_memory
.exceptions | intel_onchip_memory
.rodata | intel_onchip_memory
.rwdata | intel_onchip_memory
.bss | intel_onchip_memory
.heap | intel_onchip_memory
.stack | intel_onchip_memory

### Settings

Setting Name: | altera_avalon_jtag_uart_driver.enable_jtag_uart_ignore_fifo_full_error
Identifier: | ALTERA_AVALON_JTAG_UART_IGNORE_FIFO_FULL_ERROR
Default Value: | false
Value: | false
Type: | BooleanDefineOnly
Destination: | public_mk_define
Description: | Enable JTAG UART driver to recover when host is inactive causing buffer to full without returning error. Printf will not fail with this recovery.
Restrictions: | none

Setting Name: | altera_avalon_jtag_uart_driver.enable_small_driver
Identifier: | ALTERA_AVALON_JTAG_UART_SMALL
Default Value: | false
Value: | false
Type: | BooleanDefineOnly
Destination: | public_mk_define
Description: | Small-footprint (polled mode) driver
Restrictions: | none

Setting Name: | hal.dfl_start_address
Identifier: | INTEL_FPGA_DFL_START_ADDRESS
Default Value: | -1
Value: | -1
Type: | DecimalNumber
Destination: | system_h_define
Description: | Start address of DFL for DFL walker to read.
Restrictions: | If hal.use_dfl_walker is false, this setting is ignored; If hal.use_dfl_walker is true, this setting must match the base address of the DFL ROM instance that specifies the system.

Setting Name: | hal.enable_c_plus_plus
Identifier: | none
Default Value: | 1
Value: | 1
Type: | Boolean
Destination: | none
Description: | Enable support for a subset of the C++ language. This option increases code footprint by adding support for C++ constructors. Certain features, such as multiple inheritance and exceptions are not supported. If false, adds -DALT_NO_C_PLUS_PLUS to ALT_CPPFLAGS in public.mk, and reduces code footprint.
Restrictions: | none

Setting Name: | hal.enable_clean_exit
Identifier: | none
Default Value: | 1
Value: | 1
Type: | Boolean
Destination: | none
Description: | When your application exits, close file descriptors, call C++ destructors, etc. Code footprint can be reduced by disabling clean exit. If disabled, defines ALT_NO_CLEAN_EXIT and adds -D'exit(a)=_exit(a)' to compile options.
Restrictions: | none

Setting Name: | hal.enable_exit
Identifier: | none
Default Value: | 1
Value: | 1
Type: | Boolean
Destination: | none
Description: | Add exit() support. This option increases code footprint if your "main()" routine does "return" or call "exit()". If false, defines ALT_NO_EXIT and reduces footprint.
Restrictions: | none

Setting Name: | hal.enable_instruction_related_exceptions_api
Identifier: | ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API
Default Value: | false
Value: | false
Type: | BooleanDefineOnly
Destination: | system_h_define
Description: | Enables API for registering handlers to service instruction-related exceptions. Enabling this setting increases the size of the exception entry code.
Restrictions: | These exception types can be generated if various processor options are enabled, such as the MMU, MPU, or other advanced exception types.

Setting Name: | hal.enable_lightweight_device_driver_api
Identifier: | ALT_USE_DIRECT_DRIVERS
Default Value: | false
Value: | false
Type: | BooleanDefineOnly
Destination: | public_mk_define
Description: | Enables lightweight device driver API. This reduces code and data footprint by removing the HAL layer that maps device names (e.g. /dev/uart0) to file descriptors. Instead, driver routines are called directly. The open(), close(), and lseek() routines will always fail if called. The read(), write(), fstat(), ioctl(), and isatty() routines only work for the stdio devices. If true, defines ALT_USE_DIRECT_DRIVERS.
Restrictions: | The Altera Host and read-only ZIP file systems can't be used if hal.enable_lightweight_device_driver_api is true.

Setting Name: | hal.enable_reduced_device_drivers
Identifier: | ALT_USE_SMALL_DRIVERS
Default Value: | false
Value: | false
Type: | BooleanDefineOnly
Destination: | public_mk_define
Description: | Certain drivers are compiled with reduced functionality to reduce code footprint. Not all drivers observe this setting. The altera_avalon_uart and altera_avalon_jtag_uart drivers switch from interrupt-driven to polled operation. CAUTION: Several device drivers are disabled entirely. These include the altera_avalon_cfi_flash, altera_avalon_epcs_flash_controller, and altera_avalon_lcd_16207 drivers. This can result in certain API (HAL flash access routines) to fail. You can define a symbol provided by each driver to prevent it from being removed. If true, defines ALT_USE_SMALL_DRIVERS.
Restrictions: | none

Setting Name: | hal.enable_runtime_stack_checking
Identifier: | ALT_STACK_CHECK
Default Value: | false
Value: | false
Type: | BooleanDefineOnly
Destination: | public_mk_define
Description: | Turns on HAL runtime stack checking feature. Enabling this setting causes heap memory allocation to check for potential stack collisions.
Restrictions: | none

Setting Name: | hal.enable_sim_optimize
Identifier: | ALT_SIM_OPTIMIZE
Default Value: | false
Value: | false
Type: | BooleanDefineOnly
Destination: | public_mk_define
Description: | The BSP is compiled with optimizations to speedup HDL simulation such as initializing the cache, clearing the .bss section, and skipping long delay loops. If true, defines ALT_SIM_OPTIMIZE.
Restrictions: | When this setting is true, the BSP shouldn't be used to build applications that are expected to run real hardware.

Setting Name: | hal.linker.allow_code_at_reset
Identifier: | ALT_ALLOW_CODE_AT_RESET
Default Value: | 0
Value: | 1
Type: | Boolean
Destination: | none
Description: | Indicates if initialization code is allowed at the reset address. If true, defines the macro ALT_ALLOW_CODE_AT_RESET in linker.h.
Restrictions: | If true, defines the macro ALT_ALLOW_CODE_AT_RESET in linker.h. This setting is typically false if an external bootloader (e.g. flash bootloader) is present.

Setting Name: | hal.linker.enable_alt_load
Identifier: | none
Default Value: | 0
Value: | 1
Type: | Boolean
Destination: | none
Description: | Enables the alt_load() facility. The alt_load() facility copies data sections (.rodata, .rwdata, or .exceptions) from boot memory to RAM. If true, this setting sets up the VMA/LMA of sections in linker.x to allow them to be loaded into the .text memory.
Restrictions: | This setting is typically false if an external bootloader (e.g. flash bootloader) is present.

Setting Name: | hal.linker.enable_alt_load_copy_exceptions
Identifier: | none
Default Value: | 0
Value: | 0
Type: | Boolean
Destination: | none
Description: | Causes the alt_load() facility to copy the .exceptions section. If true, this setting defines the macro ALT_LOAD_COPY_EXCEPTIONS in linker.h.
Restrictions: | none

Setting Name: | hal.linker.enable_alt_load_copy_rodata
Identifier: | none
Default Value: | 0
Value: | 0
Type: | Boolean
Destination: | none
Description: | Causes the alt_load() facility to copy the .rodata section. If true, this setting defines the macro ALT_LOAD_COPY_RODATA in linker.h.
Restrictions: | none

Setting Name: | hal.linker.enable_alt_load_copy_rwdata
Identifier: | none
Default Value: | 0
Value: | 1
Type: | Boolean
Destination: | none
Description: | Causes the alt_load() facility to copy the .rwdata section. If true, this setting defines the macro ALT_LOAD_COPY_RWDATA in linker.h.
Restrictions: | none

Setting Name: | hal.linker.enable_exception_stack
Identifier: | none
Default Value: | 0
Value: | 0
Type: | Boolean
Destination: | none
Description: | Enables use of a separate exception stack. If true, defines the macro ALT_EXCEPTION_STACK in linker.h, adds a memory region called exception_stack to linker.x, and provides the symbols __alt_exception_stack_pointer and __alt_exception_stack_limit in linker.x.
Restrictions: | The hal.linker.exception_stack_size and hal.linker.exception_stack_memory_region_name settings must also be valid. This setting must be false for MicroC/OS-II BSPs. The exception stack can be used to improve interrupt and other exception performance if the EIC is *not* used.

Setting Name: | hal.linker.exception_stack_memory_region_name
Identifier: | none
Default Value: | none
Value: | intel_onchip_memory
Type: | UnquotedString
Destination: | none
Description: | Name of the existing memory region that will be divided up to create the 'exception_stack' memory region. The selected region name will be adjusted automatically when the BSP is generated to create the 'exception_stack' memory region.
Restrictions: | Only used if hal.linker.enable_exception_stack is true.

Setting Name: | hal.linker.exception_stack_size
Identifier: | none
Default Value: | 1024
Value: | 1024
Type: | DecimalNumber
Destination: | none
Description: | Size of the exception stack in bytes.
Restrictions: | Only used if hal.linker.enable_exception_stack is true.

Setting Name: | hal.linker.use_picolibc
Identifier: | none
Default Value: | 0
Value: | 0
Type: | Boolean
Destination: | none
Description: | Use Picolibc in place of Newlib to provide C library support
Restrictions: | none

Setting Name: | hal.log_flags
Identifier: | ALT_LOG_FLAGS
Default Value: | 0
Value: | 0
Type: | DecimalNumber
Destination: | public_mk_define
Description: | The value is assigned to ALT_LOG_FLAGS in the generated public.mk. See hal.log_port setting description. Values can be -1 through 3.
Restrictions: | hal.log_port must be set for this to be used.

Setting Name: | hal.log_port
Identifier: | ALT_LOG_ENABLE
Default Value: | none
Value: | none
Type: | UnquotedString
Destination: | public_mk_define
Description: | Slave descriptor of debug logging character-mode device. If defined, it enables extra debug messages in the HAL source. This setting is used by the ALT_LOG_PORT family of defines in system.h.
Restrictions: | none

Setting Name: | hal.make.asflags
Identifier: | ASFLAGS
Default Value: | -Wa,-gdwarf2
Value: | -Wa,-gdwarf2
Type: | UnquotedString
Destination: | makefile_variable
Description: | Custom flags only passed to the assembler.
Restrictions: | none

Setting Name: | hal.make.cflags_debug
Identifier: | none
Default Value: | -g
Value: | -g
Type: | UnquotedString
Destination: | makefile_variable
Description: | This setting defines flags used by the compiler for when CMAKE_BUILD_TYPE=Debug, which is the default build type. '-g' provides the default set of debug symbols typically required to debug a typical application.
Restrictions: | none

Setting Name: | hal.make.cflags_defined_symbols
Identifier: | none
Default Value: | none
Value: | none
Type: | UnquotedString
Destination: | none
Description: | Preprocessor macros to define. A macro definition in this setting has the same effect as a "#define" in source code. Adding "-DALT_DEBUG" to this setting has the same effect as "#define ALT_DEBUG" in a souce file. Adding "-DFOO=1" to this setting is equivalent to the macro "#define FOO 1" in a source file. Macros defined with this setting are applied to all .S, .c, and C++ files.
Restrictions: | none

Setting Name: | hal.make.cflags_optimization
Identifier: | none
Default Value: | -O2
Value: | -O2
Type: | UnquotedString
Destination: | makefile_variable
Description: | This setting defines the flags used by the compiler for CMAKE_BUILD_TYPE=Release. "-O0" = no optimization,"-O2" = "normal" optimization, etc. "-O0" is recommended for code that you want to debug since compiler optimization can remove variables and produce non-sequential execution of code while debugging.
Restrictions: | none

Setting Name: | hal.make.cflags_undefined_symbols
Identifier: | none
Default Value: | none
Value: | none
Type: | UnquotedString
Destination: | none
Description: | Preprocessor macros to undefine. Undefined macros are similar to defined macros, but replicate the "#undef" directive in source code. To undefine the macro FOO use the syntax "-u FOO" in this setting. This is equivalent to "#undef FOO" in a source file. Note: the syntax differs from macro definition (there is a space, i.e. "-u FOO" versus "-DFOO"). Macros defined with this setting are applied to all .S, .c, and C++ files.
Restrictions: | none

Setting Name: | hal.make.cflags_user_flags
Identifier: | none
Default Value: | none
Value: | none
Type: | UnquotedString
Destination: | none
Description: | Custom flags passed to the compiler when compiling C, C++, and .S files. This setting defines flags that are always used by the compiler.
Restrictions: | none

Setting Name: | hal.make.cflags_warnings
Identifier: | none
Default Value: | -Wall -Wformat-security
Value: | -Wall -Wformat-security
Type: | UnquotedString
Destination: | none
Description: | C/C++ compiler warning level. "-Wall" is commonly used. "-Wformat-security" warns about calls to "printf" and "scanf" functions where the format string is not a string literal and there are no format arguments. This setting defines warn flags that are always used by the compiler.
Restrictions: | none

Setting Name: | hal.make.cxx_flags
Identifier: | CXXFLAGS
Default Value: | none
Value: | none
Type: | UnquotedString
Destination: | makefile_variable
Description: | Custom flags only passed to the C++ compiler.
Restrictions: | none

Setting Name: | hal.make.enable_cflag_fstack_protector_strong
Identifier: | none
Default Value: | 1
Value: | 1
Type: | Boolean
Destination: | none
Description: | Enable the fstack-protector-strong compiler flag.
Restrictions: | none

Setting Name: | hal.make.enable_cflag_wformat_security
Identifier: | none
Default Value: | 1
Value: | 1
Type: | Boolean
Destination: | none
Description: | Enable the Wformat and Wformat-security compiler flags.
Restrictions: | none

Setting Name: | hal.make.link_flags
Identifier: | none
Default Value: | none
Value: | none
Type: | UnquotedString
Destination: | none
Description: | Linker flags.
Restrictions: | none

Setting Name: | hal.make.objdump_flags
Identifier: | none
Default Value: | -Sdtx
Value: | -Sdtx
Type: | UnquotedString
Destination: | none
Description: | Objdump flags.
Restrictions: | none

Setting Name: | hal.max_file_descriptors
Identifier: | ALT_MAX_FD
Default Value: | 32
Value: | 32
Type: | DecimalNumber
Destination: | system_h_define
Description: | Determines the number of file descriptors statically allocated. This setting defines the value of ALT_MAX_FD in system.h.
Restrictions: | If hal.enable_lightweight_device_driver_api is true, there are no file descriptors so this setting is ignored. If hal.enable_lightweight_device_driver_api is false, this setting must be at least 4 because HAL needs a file descriptor for /dev/null, /dev/stdin, /dev/stdout, and /dev/stderr.

Setting Name: | hal.stderr
Identifier: | none
Default Value: | none
Value: | jtag_uart
Type: | UnquotedString
Destination: | system_h_define
Description: | Slave descriptor of STDERR character-mode device. This setting is used by the ALT_STDERR family of defines in system.h.
Restrictions: | none

Setting Name: | hal.stdin
Identifier: | none
Default Value: | none
Value: | jtag_uart
Type: | UnquotedString
Destination: | system_h_define
Description: | Slave descriptor of STDIN character-mode device. This setting is used by the ALT_STDIN family of defines in system.h.
Restrictions: | none

Setting Name: | hal.stdout
Identifier: | none
Default Value: | none
Value: | jtag_uart
Type: | UnquotedString
Destination: | system_h_define
Description: | Slave descriptor of STDOUT character-mode device. This setting is used by the ALT_STDOUT family of defines in system.h.
Restrictions: | none

Setting Name: | hal.sys_clk_timer
Identifier: | ALT_SYS_CLK
Default Value: | none
Value: | intel_niosv_m
Type: | UnquotedString
Destination: | system_h_define
Description: | Slave descriptor of the system clock timer device. This device provides a periodic interrupt ("tick") and is typically required for RTOS use. This setting defines the value of ALT_SYS_CLK in system.h.
Restrictions: | none

Setting Name: | hal.timestamp_timer
Identifier: | ALT_TIMESTAMP_CLK
Default Value: | none
Value: | intel_niosv_m
Type: | UnquotedString
Destination: | system_h_define
Description: | Slave descriptor of timestamp timer device. This device is used by Altera HAL timestamp drivers for high-resolution time measurement. This setting defines the value of ALT_TIMESTAMP_CLK in system.h.
Restrictions: | none

Setting Name: | hal.toolchain.ar
Identifier: | none
Default Value: | riscv32-unknown-elf-ar
Value: | riscv32-unknown-elf-ar
Type: | UnquotedString
Destination: | none
Description: | Archiver command. Creates library files from object files. If ${toolchain.enable_executable_overrides} is true, this setting's value will override the default value of ${toolchain.prefix}ar.
Restrictions: | none

Setting Name: | hal.toolchain.as
Identifier: | none
Default Value: | riscv32-unknown-elf-gcc
Value: | riscv32-unknown-elf-gcc
Type: | UnquotedString
Destination: | none
Description: | Assembler command. Note that GCC is used by default so that .S files are run through the C pre-processor. If ${toolchain.enable_executable_overrides} is true, this setting's value will override the default value of ${toolchain.prefix}gcc.
Restrictions: | none

Setting Name: | hal.toolchain.cc
Identifier: | none
Default Value: | riscv32-unknown-elf-gcc
Value: | riscv32-unknown-elf-gcc
Type: | UnquotedString
Destination: | none
Description: | C compiler command. If ${toolchain.enable_executable_overrides} is true, this setting's value will override the default value of ${make.toolchain_prefix}gcc.
Restrictions: | none

Setting Name: | hal.toolchain.cxx
Identifier: | none
Default Value: | riscv32-unknown-elf-g++
Value: | riscv32-unknown-elf-g++
Type: | UnquotedString
Destination: | none
Description: | C++ compiler command. If ${toolchain.enable_executable_overrides} is true, this setting's value will override the default value of ${toolchain.prefix}g++.
Restrictions: | none

Setting Name: | hal.toolchain.enable_executable_overrides
Identifier: | none
Default Value: | 0
Value: | 0
Type: | Boolean
Destination: | none
Description: | Enable custom values to be set for the toolchain executables - the settings toolchain.ar, toolchain.as, toolchain.cc, toolchain.cxx, and toolchain.objdump can be set to custom values.
Restrictions: | none

Setting Name: | hal.toolchain.objdump
Identifier: | none
Default Value: | riscv32-unknown-elf-objdump
Value: | riscv32-unknown-elf-objdump
Type: | UnquotedString
Destination: | none
Description: | Objdump command. If ${toolchain.enable_executable_overrides} is true, this setting's value will override the default value of ${toolchain.prefix}objdump.
Restrictions: | none

Setting Name: | hal.toolchain.prefix
Identifier: | none
Default Value: | riscv32-unknown-elf-
Value: | riscv32-unknown-elf-
Type: | UnquotedString
Destination: | none
Description: | Prefix to be used for toolchain executables. The value will affect the individual values of the archiver, assembler, compiler, and linker - specifically, it will affect the settings toolchain.ar, toolchain.as, toolchain.cc, toolchain.cxx, and toolchain.objdump. The value will be used like so: ${toolchain.prefix}gcc, ${toolchain.prefix}objdump, etc. However, if the override setting toolchain.enable_executable_overrides is enabled, the individual settings toolchain.ar, toolchain.as, toolchain.cc, toolchain.cxx, and toolchain.objdump may be set to custom values and will not be derived from this setting's value. The 'riscv32-unknown-elf' toolchain is available with the RiscFree IDE for Intel FPGAs. Users must install the RiscFree IDE for Intel FPGAs to use this toolchain.
Restrictions: | none

Setting Name: | hal.use_dfl_walker
Identifier: | INTEL_FPGA_USE_DFL_WALKER
Default Value: | 0
Value: | 0
Type: | Boolean
Destination: | system_h_define
Description: | Determines whether to include the DFL walker code in fpga_platform_init() to discover interface information to use fpga_open() to obtain a handle.
Restrictions: | none

Setting Name: | intel_niosv_m_hal_driver.internal_timer_ticks_per_sec
Identifier: | NIOSV_INTERNAL_TIMER_TICKS_PER_SECOND
Default Value: | 1000
Value: | 1000
Type: | DecimalNumber
Destination: | system_h_define
Description: | Sets the tick rate in ticks per second for the internal timer.
Restrictions: | none