Configuration
XWOS configuration
Categories:
13 minute read
Configuration
All XWOS configuration files are centralized in the board_name/cfg folder:
cfg/project.h: project configuration filecfg/arch.h: ARCH configurationcfg/cpu.h: CPU configurationcfg/soc.h: SOC configurationcfg/board.h: board configurationcfg/xwos.h: kernel configurationcfg/xwmd.h: middleware configurationcfg/xwcd.h: chip and peripheral configurationcfg/xwem.h: third-party component configurationcfg/xwam.h: application configurationcfg/oem.h: OEM module configurationcfg/autogen.h: auto-generated configuration
Configuration Reference
When designing XWOS, the use of existing configuration generation tools such as the Linux kernel’s Kconfig was considered. However, to reduce the workload and difficulty of cross-platform development, the decision was made to use C language header files to describe all configurations.
project.h: Project Configuration File
- ARCH
XWCFG_ARCH: architecture, select the architecture folder underxwcd/soc/XWCFG_SUBARCH: sub-architecture, select the sub-architecture folder under the architecture folderXWCFG_COMPILER: compilergcc: select gcc as the compilerllvm/clang: select clang as the compiler
XWCFG_LIBC: standard C library; currently supported:newlib: select newlib as the C librarypicolibc: select picolibc as the C libraryn: do not link to a C library
XWCFG_LDSCRIPT: relative path of the linker script, relative to the board folder
- CPU
XWCFG_CPU: CPU subset, select the CPU folder under the architecture folder
- SOC
XWCFG_SOC: system-on-chip, select the SOC folder under the CPU folder
- Board
XWCFG_BOARD: board, select the board folder underxwbd/
- Kernel Configuration
XWCFG_CORE: single-core vs multi-core selection, determines which kernel underxwos/is compiledmp: multi-coreup: single-core (uni-processor)
XWCFG_XWCD: whether to include the chip and driver library, pathxwcd/. Values:1or0XWCFG_XWMD: whether to include the middleware library, pathxwmd/. Values:1or0XWCFG_XWEM: whether to include the third-party component library, pathxwem/. Values:1or0XWCFG_XWAM: whether to include the application component library, pathxwam/. Values:1or0XWCFG_OEMPATH: search path for OEM modules- Can be a relative path, relative to
$(XWOS_BRD_DIR) - Can be an absolute path
- The path can point outside the XWOS root directory
- Can be a relative path, relative to
arch.h: ARCH Configuration
- Data endianness selection; only one may be configured as
1:ARCHCFG_LITTLE_ENDIAN: little-endianARCHCFG_BIG_ENDIAN: big-endian
- Architecture bit width; only one may be configured as
1:ARCHCFG_32BIT: 32-bitARCHCFG_64BIT: 64-bit
- Floating-point unit
ARCHCFG_FPU: whether an FPU is included. Values:1or0
- C standard library
ARCHCFG_COMPILER_ERRNO: whether to use error codes defined in libc’serrno.h. Values:1or0
- Bit operations and atomic operations
ARCHCFG_LIB_XWBOP_<OP>: whether to use assembly-implemented bit operation functions <OP>. Values:1or0ARCHCFG_LIB_XWBMPOP_<OP>: whether to use assembly-implemented bitmap operation functions <OP>. Values:1or0ARCHCFG_LIB_XWAOP_<OP>: whether to use assembly-implemented atomic operation function set <OP>. Values:1or0ARCHCFG_LIB_XWBMPAOP_<OP>: whether to use assembly-implemented bitmap atomic operation function set <OP>. Values:1or0
cpu.h: CPU Configuration
CPUCFG_CPU_NUM: number of CPUs, only effective for SMP systemsCPUCFG_L1_CACHELINE_SIZE: L1 cache CacheLine size, only effective for SOCs with L1 cache
soc.h: SOC Configuration
- ARM-M
SOCCFG_EXC_NUM: number of SOC exceptions, fixed at 16SOCCFG_IRQ_NUM: number of SOC peripheral interruptsSOCCFG_NVIC_PRIO_BITNUM: number of bits in the ARM-M interrupt priority registerSOCCFG_NVIC_SUBPRIO_BITIDX: the starting bit index of the ARM-M sub-prioritySOCCFG_BUG: whether the SOC provides asoc_bug()definition. Values:1or0SOCCFG_CRC32: whether the SOC provides a CRC32 computation unit. Values:1or0SOCCFG_CRC8: whether the SOC provides a CRC8 computation unit. Values:1or0
- nuclei RISC-V bumblebee (rv32imac)
SOCCFG_EXC_NUM: number of SOC exceptions, fixed at 16SOCCFG_IRQ_NUM: number of SOC peripheral interruptsSOCCFG_BUG: whether the SOC provides asoc_bug()definition. Values:1or0SOCCFG_CRC32: whether the SOC provides a CRC32 computation unit. Values:1or0SOCCFG_CRC8: whether the SOC provides a CRC8 computation unit. Values:1or0
- EPPC (e200z0)
SOCCFG_EXC_NUM: number of SOC exceptions, fixed at 9SOCCFG_IRQ_NUM: number of SOC peripheral interruptsSOCCFG_SYSHWT_SRCCLK: tick timer frequencySOCCFG_SYSHWT_CHANNEL: tick timer channelSOCCFG_CLK_FXOSC: whether the external fast crystal oscillator is enabledSOCCFG_CLK_FXOSC_VALUE: external fast crystal oscillator frequencySOCCFG_CLK_FXOSC_DIV: external fast crystal oscillator division factorSOCCFG_CLK_FIRC: whether the internal fast RC oscillator is enabledSOCCFG_CLK_FIRC_VALUE: internal fast RC oscillator frequencySOCCFG_CLK_FIRC_DIV: internal fast RC oscillator division factorSOCCFG_CLK_SCOSC: whether the external slow crystal oscillator is enabledSOCCFG_CLK_SCOSC_VALUE: external slow crystal oscillator frequencySOCCFG_CLK_SCOSC_DIV: external slow crystal oscillator division factorSOCCFG_CLK_SIRC_VALUE: internal slow RC oscillator frequencySOCCFG_CLK_SIRC_DIV: internal slow RC oscillator division factorSOCCFG_CLK_FMPLL_VALUE: PLL frequencySOCCFG_BUG: whether the SOC provides asoc_bug()definition. Values:1or0SOCCFG_BKUP: whether the backup RAM area is enabled. Values:1or0SOCCFG_CRC32: whether the SOC provides a CRC32 computation unit. Values:1or0SOCCFG_CRC8: whether the SOC provides a CRC8 computation unit. Values:1or0
board.h: Board Configuration
- XWOS HOOK
BRDCFG_XWSKD_IDLE_HOOK: whether to use the idle task HOOK. Values:1or0- When set to
1, the definition ofvoid board_xwskd_idle_hook(struct xwospl_skd *)must be provided
- When set to
BRDCFG_XWSKD_PRE_SWCX_HOOK: whether to use the pre-context-switch HOOK. Values:1or0- When set to
1, the definition ofvoid board_xwskd_pre_swcx_hook(struct xwospl_skd *)must be provided
- When set to
BRDCFG_XWSKD_POST_SWCX_HOOK: whether to use the post-context-switch HOOK. Values:1or0- When set to
1, the definition ofvoid board_xwskd_post_swcx_hook(struct xwospl_skd *)must be provided
- When set to
BRDCFG_XWSKD_SYSHWT_HOOK: whether to use the system tick timer interrupt HOOK. Values:1or0- When set to
1, the definition ofvoid board_xwskd_syshwt_hook(struct xwospl_skd *)must be provided
- When set to
BRDCFG_XWSKD_THD_STACK_POOL: whether a thread stack memory pool is provided. Values:1or0- When set to
1, the definitions ofxwer_t board_thd_stack_pool_alloc(xwsz_t , xwstk_t **)andxwer_t board_thd_stack_pool_free(xwstk_t *)must be provided BRDCFG_XWSKD_THD_POSTINIT_HOOK: whether to use the post-thread-init HOOK. Values:1or0- When set to
1, the definition ofvoid board_thd_postinit_hook(struct xwospl_thd *)must be provided
- When set to
BRDCFG_LOG: whether to support log printing. Values:1or0. When set to1, the definition ofboard_log_write()must be provided for log string output.BRDCFG_DCACHE: whether DCACHE is supported. Values:1or0BRDCFG_ICACHE: whether ICACHE is supported. Values:1or0- Binary tag
BRDCFG_FIRMWARE_TAILFLAG: defines the tag string at the end of the compiled bin file, which can be used by upgrade functions to verify file integrity
- Board module configuration:
BMCFG_<module>- The board module path must be converted to a configuration macro according to the rules in Build System. Values:
1or0
- The board module path must be converted to a configuration macro according to the rules in Build System. Values:
xwos.h: Kernel Configuration
Operating system-related configuration
XWKNCFG_CHECK_PARAMETERS: whether to enable API parameter checking. Values:1or0XWKNCFG_BUG: whether to enable BUG debugging. Values:1or0- XuanWu C Library:
- Logging
XWLIBCFG_LOG: whether to enable log debugging. Values:1or0XWLIBCFG_XWLOG_LEVEL: minimum log level;XWLIBCFG_XWLOG_BUFSIZE: log formatting buffer size;
- System calls
XWLIBCFG_SC: whether to enable system calls. Values:1or0
- Atomic operations
XWLIBCFG_XWAOP8: whether to enable 8-bit atomic operation library. Values:1or0XWLIBCFG_XWAOP16: whether to enable 16-bit atomic operation library. Values:1or0XWLIBCFG_XWAOP32: whether to enable 32-bit atomic operation library. Values:1or0XWLIBCFG_XWAOP64: whether to enable 64-bit atomic operation library. Values:1or0XWLIBCFG_XWBMPAOP: whether to enable bitmap atomic operation library. Values:1or0
- Data structures
XWLIBCFG_MAP: whether to enable key-value map. Values:1or0
- CRC
XWLIBCFG_CRC32: whether to enable CRC32. Values:1or0XWLIBCFG_CRC32_0X04C11DB7: whether to enable CRC32 polynomial 0x04C11DB7. Values:1or0XWLIBCFG_CRC32_0XEDB88320: whether to enable CRC32 polynomial 0xEDB88320. Values:1or0XWLIBCFG_CRC8: whether to enable CRC8. Values:1or0XWLIBCFG_CRC8_0X07: whether to enable CRC8 polynomial 0x07. Values:1or0XWLIBCFG_CRC8_0X31: whether to enable CRC8 polynomial 0x31. Values:1or0XWLIBCFG_CRC8_0X9B: whether to enable CRC8 polynomial 0x9B. Values:1or0
- Long jump
XWLIBCFG_SETJMP: whether to enablesetjmp()/longjmp(). Values:1or0
- Logging
- Memory management
XWMMCFG_ALIGNMENT: memory management alignment in bytes, typically set to 8 bytesXWMMCFG_STACK_ALIGNMENT: thread stack alignment in bytes, typically set to 8 bytesXWMMCFG_STACK_SIZE_DEFAULT: default stack memory sizeXWMMCFG_STACK_SIZE_MIN: minimum stack memory sizeXWMMCFG_STACK_GUARD_SIZE_DEFAULT: default stack guard positionXWMMCFG_STACK_CHK_SWCX: whether to check for stack overflow on context switch. Values:1or0- Stack type; only one may be configured as
1:XWMMCFG_FD_STACK: full descending stackXWMMCFG_ED_STACK: empty descending stackXWMMCFG_FA_STACK: full ascending stackXWMMCFG_EA_STACK: empty ascending stack
XWMMCFG_MEMSLICE: whether to enable the memory slice algorithm. Values:1or0XWMMCFG_BMA: whether to enable the buddy algorithm. Values:1or0XWMMCFG_MEMPOOL: whether to enable memory pools. Values:1or0
- Kernel configuration
- Scheduler
XWOSCFG_SYSHWT_PERIOD: hardware timer period, in nanosecondsXWOSCFG_SKD_PRIORITY_RT_NUM: number of scheduler real-time priorities; smaller values save memoryXWOSCFG_SKD_IDLE_STACK_SIZE: idle task stack sizeXWOSCFG_SKD_IDLE_TLS: whether to enable TLS (thread-local storage) for the idle task. Values:1or0XWOSCFG_SKD_BH: whether to enable bottom half. Values:1or0XWOSCFG_SKD_BH_STACK_SIZE: bottom half stack sizeXWOSCFG_SKD_BH_TLS: whether to enable TLS (thread-local storage) for the bottom half task. Values:1or0XWOSCFG_SKD_PM: whether to enable power management. This configuration is only effective for single-core systems; multi-core systems cannot disable power management. Values:1or0XWOSCFG_SKD_THD_PRIVILEGED_DEFAULT: whether threads are privileged by default. Values:1or0XWOSCFG_SKD_THD_MEMPOOL: whether to enable mempool thread object cache. Values:1or0XWOSCFG_SKD_THD_MEMSLICE: whether to enable memslice thread object cache. Values:1or0XWOSCFG_SKD_THD_SMA: whether to enable SMA thread object cache. Values:1or0XWOSCFG_SKD_THD_STDC_MM: whether to enable C standard librarymalloc()for dynamic thread object creation. Values:1or0XWOSCFG_SKD_THD_LOCAL_DATA_NUM: number of thread-local data itemsXWOSCFG_SKD_THD_EXIT: whether to enable thread exit. Values:1or0XWOSCFG_SKD_SWT: whether to enable software timers. Values:1or0XWOSCFG_SKD_SWT_MEMPOOL: whether to enable mempool software timer object cache. Values:1or0XWOSCFG_SKD_SWT_MEMSLICE: whether to enable memslice software timer object cache. Values:1or0XWOSCFG_SKD_SWT_SMA: whether to enable SMA software timer object cache. Values:1or0XWOSCFG_SKD_SWT_STDC_MM: whether to enable C standard librarymalloc()for dynamic timer object creation. Values:1or0
- Synchronization
XWOSCFG_SYNC_PLSEM: whether to enable pipeline semaphore. Values:1or0XWOSCFG_SYNC_RTSEM: whether to enable real-time semaphore. Values:1or0XWOSCFG_SYNC_SEM_MEMPOOL: whether to enable mempool semaphore object cache. Values:1or0XWOSCFG_SYNC_SEM_MEMSLICE: whether to enable memslice semaphore object cache. Values:1or0XWOSCFG_SYNC_SEM_SMA: whether to enable SMA semaphore object cache. Values:1or0XWOSCFG_SYNC_SEM_STDC_MM: whether to enable C standard librarymalloc()for dynamic semaphore object creation. Values:1or0XWOSCFG_SYNC_COND: whether to enable condition variables. Values:1or0XWOSCFG_SYNC_COND_MEMPOOL: whether to enable mempool condition variable object cache. Values:1or0XWOSCFG_SYNC_COND_MEMSLICE: whether to enable memslice condition variable object cache. Values:1or0XWOSCFG_SYNC_COND_SMA: whether to enable SMA condition variable object cache. Values:1or0XWOSCFG_SYNC_COND_STDC_MM: whether to enable C standard librarymalloc()for dynamic condition variable object creation. Values:1or0XWOSCFG_SYNC_EVT: whether to enable events. Values:1or0XWOSCFG_SYNC_EVT_MEMPOOL: whether to enable mempool event object cache. Values:1or0XWOSCFG_SYNC_EVT_MEMSLICE: whether to enable memslice event object cache. Values:1or0XWOSCFG_SYNC_EVT_SMA: whether to enable SMA event object cache. Values:1or0XWOSCFG_SYNC_EVT_STDC_MM: whether to enable C standard librarymalloc()for dynamic event object creation. Values:1or0
- Locks
XWOSCFG_LOCK_MTX: whether to enable mutex. Values:1or0XWOSCFG_LOCK_MTX_MEMPOOL: whether to enable mempool mutex object cache. Values:1or0XWOSCFG_LOCK_MTX_MEMSLICE: whether to enable memslice mutex object cache. Values:1or0XWOSCFG_LOCK_MTX_SMA: whether to enable SMA mutex object cache. Values:1or0XWOSCFG_LOCK_MTX_STDC_MM: whether to enable C standard librarymalloc()for dynamic mutex object creation. Values:1or0XWOSCFG_LOCK_FAKEMTX: whether to enable fake mutex. Values:1or0
- Scheduler
xwmd.h: Middleware Configuration
XWMDCFG_CHECK_PARAMETERS: whether to enable API parameter checking. Values:1or0XWMDCFG_isc_xwssc: whether to enable point-to-point communication protocol. Values:1or0XWMDCFG_isc_xwssc_LOG: whether to enable logging. Values:1or0XWMDCFG_isc_xwssc_PORT_NUM: number of message channelsXWMDCFG_isc_xwssc_PRI_NUM: number of message prioritiesXWMDCFG_isc_xwssc_RETRY_PERIOD: message retransmission periodXWMDCFG_isc_xwssc_RETRY_NUM: maximum number of message retransmissionsXWMDCFG_isc_xwssc_MEMBLK_SIZE: unit memory block size for sending and receivingXWMDCFG_isc_xwssc_MEMBLK_ODR: number of unit memory blocks, expressed as a power of 2; the configured value is the exponent nXWMDCFG_isc_xwssc_RXTHD_PRIORITY: receive thread priorityXWMDCFG_isc_xwssc_TXTHD_PRIORITY: transmit thread priority
XWMDCFG_isc_xwmq: whether to enable message queue. Values:1or0XWMDCFG_isc_xwcq: whether to enable circular queue. Values:1or0XWMDCFG_libc: whether to enable libc adapter code. Values:1or0XWMDCFG_xwrust_ffi: whether to enable XWOS Rust underlying C language interface. Values:1or0
xwcd.h: Chip and Peripheral Configuration
XWCDCFG_CHECK_PARAMETERS: whether to enable API parameter checking. Values:1or0XWCDCFG_ds: whether to enable the XuanWu device stack. Values:1or0XWCDCFG_ds_LITE: whether to enable the LITE version of the XuanWu device stack. Values:1or0XWCDCFG_ds_PM: whether to enable power management. Values:1or0XWCDCFG_ds_SOC: whether to enable SOC. Values:1or0XWCDCFG_ds_SOC_CLK: whether to enable SOC Clock. Values:1or0XWCDCFG_ds_SOC_PWR: whether to enable SOC Power. Values:1or0XWCDCFG_ds_SOC_GPIO: whether to enable SOC GPIO. Values:1or0XWCDCFG_ds_SOC_EIRQ: whether to enable SOC external IO interrupts. Values:1or0XWCDCFG_ds_SOC_EIRQ_ROISRT: whether the SOC external IO interrupt vector table isconst. Values:1or0XWCDCFG_ds_SOC_DMA: whether to enable SOC DMA. Values:1or0XWCDCFG_ds_SOC_DMA_ROCBT: whether the SOC external DMA callback function table isconst. Values:1or0XWCDCFG_ds_UART: whether to enable UART. Values:1or0XWCDCFG_ds_UART_RXQ_SIZE: UART receive queue sizeXWCDCFG_ds_I2C_MASTER: whether to enable I2C bus controller. Values:1or0XWCDCFG_ds_I2C_PERIPHERAL: whether to enable I2C peripheral. Values:1or0XWCDCFG_ds_SPI_MASTER: whether to enable SPI bus controller. Values:1or0XWCDCFG_ds_SPI_PERIPHERAL: whether to enable SPI peripheral. Values:1or0XWCDCFG_ds_LIN: whether to enable LIN bus. Values:1or0XWCDCFG_ds_LINID: whether to enable LIN bus ID check table. Values:1or0XWCDCFG_ds_CAN: whether to enable CAN bus. Values:1or0XWCDCFG_ds_CAN_CONTROLLER: whether to enable CAN controller. Values:1or0XWCDCFG_ds_CAN_CONTROLLER_ROCBT: whether the CAN controller callback function table is read-only. Values:1or0XWCDCFG_ds_CAN_CONTROLLER_SDU_MAXSIZE: maximum CAN message data sizeXWCDCFG_ds_CAN_CONTROLLER_RXQNUM: maximum number of CAN receive queuesXWCDCFG_ds_CAN_CONTROLLER_I2CP: whether the CAN controller is an I2C peripheral. Values:1or0XWCDCFG_ds_CAN_CONTROLLER_SPIP: whether the CAN controller is an SPI peripheral. Values:1or0
XWCDCFG_ds_CAN_TRANSCEIVER: whether to enable CAN transceiver. Values:1or0XWCDCFG_ds_CAN_TRANSCEIVER_I2CP: whether the CAN transceiver is an I2C peripheral. Values:1or0XWCDCFG_ds_CAN_TRANSCEIVER_SPIP: whether the CAN transceiver is an SPI peripheral. Values:1or0
XWCDCFG_ds_MISC: whether to enable MISC devices. Values:1or0
XWCDCFG_peripheral_i2c_eeprom: whether to enable I2C EEPROM driver. Values:1or0XWCDCFG_peripheral_spi_flash_w25qxx: whether to enable SPI FLASH W25Q driver. Values:1or0XWCDCFG_peripheral_spi_lcd_st7735: whether to enable SPI LCD ST7735 driver. Values:1or0XWCDCFG_peripheral_can_transceiver_tja1042: whether to enable CAN transceiver TJA1042 driver. Values:1or0
xwem.h: Third-party Software Configuration
XWEMCFG_serializing_nanopb: whether to enable protobuf-nanopb. Values:1or0XWEMCFG_fs_fatfs: whether to enable FatFs. Values:1or0XWEMCFG_fs_littlefs: whether to enable littlefs. Values:1or0XWEMCFG_fs_spiffs: whether to enable spiffs. Values:1or0XWEMCFG_fs_dhara: whether to enable dhara. Values:1or0XWEMCFG_vm_lua: whether to enable the Lua language. Values:1or0XWEMCFG_vm_lua_INT_TYPE: integer type in LuaXWEMCFG_vm_lua_FLOAT_TYPE: floating-point type in LuaXWEMCFG_vm_lua_THD_STACK_SIZE: Lua interactive interpreter thread stack sizeXWEMCFG_vm_lua_BRDLIBS: whether to enable BSP Lua libraries. Values:1or0
xwam.h: Application Configuration
XWAMCFG_example_xwobj: whether to enable the XuanWu Object example. Values:1or0XWAMCFG_example_thd_new: whether to enable the Thread Creation example. Values:1or0XWAMCFG_example_thd_exit: whether to enable the Thread Exit example. Values:1or0XWAMCFG_example_thd_sleep: whether to enable the Thread Sleep example. Values:1or0XWAMCFG_example_swt: whether to enable the Software Timer example. Values:1or0XWAMCFG_example_lock_cpuirq: whether to enable the CPU Interrupt example. Values:1or0XWAMCFG_example_lock_mtx: whether to enable the Mutex example. Values:1or0XWAMCFG_example_lock_spinlock: whether to enable the Spinlock example. Values:1or0XWAMCFG_example_lock_seqlock: whether to enable the Sequence Lock example. Values:1or0XWAMCFG_example_sync_sem: whether to enable the Semaphore example. Values:1or0XWAMCFG_example_sync_cond: whether to enable the Condition Variable example. Values:1or0XWAMCFG_example_sync_br: whether to enable the Thread Barrier example. Values:1or0XWAMCFG_example_sync_flg: whether to enable the Event Flag example. Values:1or0XWAMCFG_example_sync_sel: whether to enable the Signal Selector example. Values:1or0XWAMCFG_example_mm_sma: whether to enable the Simple Memory Allocator example. Values:1or0XWAMCFG_example_mm_memslice: whether to enable the Memory Slice Allocator example. Values:1or0XWAMCFG_example_mm_bma: whether to enable the Buddy Algorithm Allocator example. Values:1or0XWAMCFG_example_xwlib_crc: whether to enable the CRC Computation example. Values:1or0XWAMCFG_example_cxx: whether to enable the C++ example. Values:1or0XWAMCFG_example_isc_xwmq: whether to enable the Message Queue example. Values:1or0XWAMCFG_example_isc_xwcq: whether to enable the Circular Queue example. Values:1or0XWAMCFG_application_w25qrpt: whether to enable the W25Q Read/Write Tool application. Values:1or0XWAMCFG_application_ramcode: whether to enable the RAMCODE application. Values:1or0