4. SDK Directory Structure
This chapter describes the directories and files of Nsing.N32G033_Library.1.3.0 based on its actual file tree. All paths are relative to the SDK root.
4.1 Top-Level Layout
- ๐ Names ending in
/are directories - ๐ All other names are files
Nsing.N32G033_Library.1.3.0/
โโโ .vscode/
โ โโโ launch.json
โ โโโ settings.json
โ โโโ tasks.json
โโโ firmware/
โ โโโ CMSIS/
โ โโโ n32g033_std_periph_driver/
โโโ jlink/
โ โโโ flash.jlink
โโโ Middlewares/
โ โโโ freertos/
โ โโโ N32_SelfTest_Library/
โโโ projects/
โ โโโ n32g033_EVAL/
โโโ N32G033 version history.txt
| Relative path | Purpose |
|---|---|
firmware/ |
Firmware library: CMSIS core and device support files, standard peripheral driver library |
Middlewares/ |
Middleware: FreeRTOS kernel and the N32 self-test library |
projects/n32g033_EVAL/ |
Evaluation board projects: board support, peripheral examples, and application projects |
jlink/flash.jlink |
J-Link Commander download script, called by the download target of the GCC project |
.vscode/ |
VS Code GDB debug, build task, and editor settings |
N32G033 version history.txt |
SDK version history |
4.2 Firmware Library
๐ firmware/CMSIS
core/ holds the Arm CMSIS-Core headers, of which Cortex-M0 projects use core_cm0.h; device/ holds the N32G033 device support files.
CMSIS/
โโโ core/
โ โโโ cmsis_armcc.h
โ โโโ cmsis_armclang.h
โ โโโ cmsis_armclang_ltm.h
โ โโโ cmsis_compiler.h
โ โโโ cmsis_gcc.h
โ โโโ cmsis_iccarm.h
โ โโโ cmsis_version.h
โ โโโ core_armv81mml.h
โ โโโ core_armv8mbl.h
โ โโโ core_armv8mml.h
โ โโโ core_cm0.h
โ โโโ core_cm0plus.h
โ โโโ core_cm1.h
โ โโโ core_cm23.h
โ โโโ core_cm3.h
โ โโโ core_cm33.h
โ โโโ core_cm35p.h
โ โโโ core_cm4.h
โ โโโ core_cm7.h
โ โโโ core_sc000.h
โ โโโ core_sc300.h
โ โโโ mpu_armv7.h
โ โโโ mpu_armv8.h
โ โโโ tz_context.h
โโโ device/
โโโ startup/
โ โโโ startup_n32g033.s
โ โโโ startup_n32g033_EWARM.S
โ โโโ startup_n32g033_EWARM_ClassB.S
โ โโโ startup_n32g033_gcc.s
โโโ n32g033.h
โโโ n32g033_conf.h
โโโ n32g033_flash.ld
โโโ system_n32g033.c
โโโ system_n32g033.h
๐ firmware/n32g033_std_periph_driver
Standard peripheral driver library: inc/ holds the driver headers and src/ the implementations of the same name, one pair per driver module.
n32g033_std_periph_driver/
โโโ inc/
โ โโโ misc.h
โ โโโ n32g033_adc.h
โ โโโ n32g033_comp.h
โ โโโ n32g033_dbg.h
โ โโโ n32g033_dma.h
โ โโโ n32g033_exti.h
โ โโโ n32g033_flash.h
โ โโโ n32g033_gpio.h
โ โโโ n32g033_hdiv.h
โ โโโ n32g033_i2c.h
โ โโโ n32g033_iwdg.h
โ โโโ n32g033_opamp.h
โ โโโ n32g033_pwr.h
โ โโโ n32g033_rcc.h
โ โโโ n32g033_spi.h
โ โโโ n32g033_sqrt.h
โ โโโ n32g033_tim.h
โ โโโ n32g033_uart.h
โโโ src/
โโโ misc.c
โโโ n32g033_adc.c
โโโ n32g033_comp.c
โโโ n32g033_dbg.c
โโโ n32g033_dma.c
โโโ n32g033_exti.c
โโโ n32g033_flash.c
โโโ n32g033_gpio.c
โโโ n32g033_hdiv.c
โโโ n32g033_i2c.c
โโโ n32g033_iwdg.c
โโโ n32g033_opamp.c
โโโ n32g033_pwr.c
โโโ n32g033_rcc.c
โโโ n32g033_spi.c
โโโ n32g033_sqrt.c
โโโ n32g033_tim.c
โโโ n32g033_uart.c
| Relative path | Purpose |
|---|---|
firmware/CMSIS/device/n32g033.h |
Device header: peripheral register structures, base addresses, and interrupt numbers |
firmware/CMSIS/device/system_n32g033.c |
System clock initialization; requires the N32G033 macro, defaults to HSI at 64 MHz, and can be set to 32 MHz or 32 kHz through SYSCLK_FREQ |
firmware/CMSIS/device/n32g033_conf.h |
Includes all driver headers and defines assert_param |
firmware/CMSIS/device/startup/startup_n32g033.s |
Keil MDK-ARM startup file |
firmware/CMSIS/device/startup/startup_n32g033_EWARM.S |
IAR EWARM startup file |
firmware/CMSIS/device/startup/startup_n32g033_EWARM_ClassB.S |
IAR EWARM startup file for the ClassB self-test, used by applications/ClassB_demo |
firmware/CMSIS/device/startup/startup_n32g033_gcc.s |
GCC startup file |
firmware/CMSIS/device/n32g033_flash.ld |
GCC linker script |
firmware/n32g033_std_periph_driver/inc/misc.h |
NVIC and SysTick configuration functions, corresponding to the NVIC module in chapter 5 |
firmware/n32g033_std_periph_driver/inc/n32g033_hdiv.h |
Hardware divider driver header |
firmware/n32g033_std_periph_driver/inc/n32g033_sqrt.h |
Square-root accelerator driver header |
4.3 Projects Directory
projects/ contains only the n32g033_EVAL/ evaluation board directory, with board support, peripheral examples, and application projects.
๐ projects/n32g033_EVAL/bsp
Board support code, referenced by the examples through the bsp/inc include path.
bsp/
โโโ inc/
โ โโโ delay.h
โ โโโ log.h
โโโ src/
โโโ delay.c
โโโ log.c
โโโ print_remap.c
๐ projects/n32g033_EVAL/examples
Peripheral examples, organized into peripheral categories, each holding several example projects.
examples/
โโโ ADC/
โโโ COMP/
โโโ Cortex-M0/
โโโ DMA/
โโโ EXTI/
โโโ FLASH/
โโโ FreeRTOS/
โโโ GPIO/
โโโ HDIV/
โโโ I2C/
โโโ IWDG/
โโโ NVIC/
โโโ OPAMP/
โโโ PWR/
โโโ RCC/
โโโ SPI/
โโโ SQRT/
โโโ TIM/
โโโ UART/
๐ projects/n32g033_EVAL/applications
Application projects that demonstrate complete usage scenarios beyond the example directories.
applications/
โโโ ClassB_demo/
โ โโโ EWARM/
โ โโโ MDK-ARM/
โ โโโ crc32_software.c
โ โโโ crc32_software.h
โ โโโ main.c
โ โโโ main.h
โ โโโ n32_cm0_it.c
โ โโโ n32_cm0_it.h
โโโ GCC_demo/
โ โโโ GCC/
โ โ โโโ Makefile
โ โโโ inc/
โ โ โโโ main.h
โ โ โโโ n32g033_it.h
โ โโโ src/
โ โ โโโ main.c
โ โ โโโ n32g033_it.c
โ โโโ readme.txt
โโโ JumpToBOOT/
โโโ MDK-ARM/
โ โโโ JumpToBOOT.uvoptx
โ โโโ JumpToBOOT.uvprojx
โโโ inc/
โ โโโ main.h
โ โโโ n32g033_it.h
โโโ src/
โ โโโ main.c
โ โโโ n32g033_it.c
โโโ readme.txt
| Relative path | Purpose |
|---|---|
projects/n32g033_EVAL/bsp/src/log.c |
Log UART initialization log_init: UART1, PA9 as TX and PA10 as RX, 115200 bps |
projects/n32g033_EVAL/bsp/inc/log.h |
log_info, log_warning, log_error, and log_debug macros, controlled by LOG_ENABLE and LOG_LEVEL |
projects/n32g033_EVAL/bsp/inc/delay.h |
SysTick delay functions SysTick_Delay_Us and SysTick_Delay_Ms |
projects/n32g033_EVAL/bsp/src/print_remap.c |
Standard I/O retarget functions _write and _read, which route printf output to the log UART |
projects/n32g033_EVAL/applications/ClassB_demo/ |
ClassB self-test routine: runs STL_InitRunTimeChecks and STL_DoRunTimeChecks with static resources from Middlewares/N32_SelfTest_Library;provides Keil and IAR projects, and the Keil project includes srecord_crc32.bat and the srecord tools under SREC/ |
projects/n32g033_EVAL/applications/JumpToBOOT/ |
Jump from the user program to SYSTEM BOOT: after reset it prints a notice and stays in the user program, and a press on the PA4 key jumps to system memory; provides a Keil project only |
projects/n32g033_EVAL/applications/GCC_demo/ |
LED blink GCC project: the Makefile defines N32G033 and uses startup_n32g033_gcc.s and n32g033_flash.ld, with all, clean, download, and debug targets |
4.4 Standard Structure of an Example
Every example directory contains source files, headers, a Keil project, an IAR project, and a readme. Take examples/GPIO/LedBlink/ as an example:
LedBlink/
โโโ EWARM/
โ โโโ LedBlink.ewd
โ โโโ LedBlink.ewp
โ โโโ LedBlink.eww
โโโ inc/
โ โโโ main.h
โ โโโ n32g033_it.h
โโโ MDK-ARM/
โ โโโ LedBlink.uvoptx
โ โโโ LedBlink.uvprojx
โโโ src/
โ โโโ main.c
โ โโโ n32g033_it.c
โโโ readme.txt
| Relative path | Purpose |
|---|---|
src/main.c |
Example main program: peripheral initialization and the main loop |
src/n32g033_it.c |
Interrupt service functions |
inc/main.h, inc/n32g033_it.h |
Example header and interrupt function declarations |
MDK-ARM/LedBlink.uvprojx |
Keil project, defining the N32G033 and USE_STDPERIPH_DRIVER compile macros |
EWARM/LedBlink.eww |
IAR workspace |
readme.txt |
Chinese and English notes: function description, development environment (toolchain and supported parts), how to use (system configuration and usage), and cautions |
Every example names its project files after the example itself (such as LedBlink.uvprojx and LedBlink.eww), and no example directory contains a GCC project. The following cases differ from the standard structure:
| Case | Example | Structure |
|---|---|---|
| Paired sub-projects that each carry a readme | UART/LIN/, UART/IrDA_Tx&Rx/ |
The LIN/ parent holds LIN_Master/ and LIN_Slave/, and the IrDA_Tx&Rx/ parent holds LP_Transmit_Receive/ and Transmit_Receive/;each sub-project carries its own src/, inc/, MDK-ARM/, EWARM/, and readme.txt |
| Extra helper sources | FreeRTOS/LED_Blink/, I2C/EEPROM/, SPI/SPI_FLASH/, UART/IrDA_Tx&Rx/, UART/LIN/, UART/MultiProcessor/ |
Their src/ also holds helper drivers such as led.c, timer.c, i2c_eeprom.c, spi_flash.c, bsp_Tim_38K.c, lin_master.c, lin_slave.c, bsp_key.c, and bsp_led.c |
Examples reference firmware/ and bsp/ through relative paths. When you copy an example, keep it at its original level under projects/n32g033_EVAL/examples/<category>/, otherwise you must also update the header and source paths in the project.
4.5 Development Aids
| Relative path | Purpose |
|---|---|
jlink/flash.jlink |
J-Link Commander script: reset, load build/output.hex, reset, run, and quit |
.vscode/launch.json |
gdb-arm debug configuration: connects arm-none-eabi-gdb to the GDB server on localhost:2331, loads the program, resets, and sets a breakpoint at main |
.vscode/tasks.json |
make_debug build task, running make debug in the GCC project directory |
.vscode/settings.json |
Editor settings and file associations |
projects/n32g033_EVAL/applications/GCC_demo/GCC/Makefile |
GCC build script: all produces build/output.elf, .hex, and .bin;download calls JLink.exe with device N32G033x8 to run jlink/flash.jlink;debug starts JLinkGDBServer.exe |
The working directory in .vscode/tasks.json is written as projects/n32g033_EVAL/examples/GPIO/Led_Blink/GCC, which does not match the example directory projects/n32g033_EVAL/examples/GPIO/LedBlink; .vscode/launch.json loads the ELF file through a fixed path and names a fixed GCC toolchain path, and the J-Link installation path in the Makefile is also a fixed value. Adjust these paths for your own environment before use.
Beyond the SDK, Nations Technologies also provides the Keil support pack, the IAR and J-Link device patches, the Flash programming algorithm package, and the initialization code generation tool; their names and versions are listed in the Documentation and Tool Navigation chapter.