Skip to content

IOsetting/air32f103-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

  • AIR32F103x / MH32F103Ax / MH2103Ax template project for GNU Arm Embedded Toolchain
  • Supported programmers: J-Link, STLink, DAPLink/PyOCD
  • Supported IDE: VSCode

AIR32F103x / MH32F103Ax / MH2103Ax Family

TYPE AIR32F103CBT6
MH32F103ACBT6
MH2103ACBT6
AIR32F103CCT6
MH32F103ACCT6
MH2103ACCT6
AIR32F103RPT6
MH32F103ARPT6
MH2103ARPT6
Flash 128K 256K 256K
RAM 32K 64K 96K
Pack lqfp48 lqfp48 lqfp64

Note

  • AIR32F103, MH32F103A and MH2103A series
    • Supplied by different vendors, but they are the same from the software aspect of view.
    • The electrical characteristics might be different, be careful when replacing them in production.
  • Unlock the hidden 97K RAM
    • It's very likely the AIR32F103CBT6 you bought have 97K RAM - Hedley Rainnie's blog
    • This also apply to AIR32F103CCT6 and AIR32F103RPT6.
    • The hidden RAM can be unlocked by special registers, the hack has been integrated into startup_air32f10x.s. Thanks to @deividAlfa.

Documents

WIKI | Datasheet | Migrate From STM32 | Keil SDK And Demos

LuatOS AIR32F103CBT6 EVB

EVB Schematis | PCB

Project Structure

├── Build                       # Build results
├── Examples                    # Example code
│   ├── FreeRTOS                  # FreeRTOS examples
│   └── NonFreeRTOS               # Non-FreeRTOS examples
├── Libraries                   
│   ├── AIR32F10xLib            # AIR32F103 Peripheral library
│   │   ├── inc                 
│   │   ├── lib
│   │   └── src  
│   ├── CMSIS
│   │   ├── Core                # CMSIS Coretex M core files
│   │   └── DSP                 # CMSIS DSP library
│   ├── Debug                   # For delay and printf support
│   ├── DeviceSupport           # gcc arm startup files
│   │   └── startup
│   │       └── arm-gcc
│   ├── FreeRTOS                # FreeRTOS library
│   ├── Helix                   # Helix MP3 decoder library
│   └── LDScripts               # Link scripts
├── Makefile
├── Misc
│   └── flash.jlink             # JLink script
├── README.cn.md
├── README.md
├── rules.mk                    # Make rules
└── User                        # User application code

Quick Start

1. Install GNU Arm Embedded Toolchain

Download toolchains from Arm GNU Toolchain Downloads and uncompress

tar xvf gcc-arm-11.2-2022.02-x86_64-arm-none-eabi.tar.xz
cd /opt/gcc-arm/
sudo mv ~/Backup/linux/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/ .
sudo chown -R root:root gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/

2. Intall SEGGER J-Link Or ST-Flash

Download JLink from J-Link / J-Trace Downloads and install it

# installation command for .deb
sudo dpkg -i JLink_Linux_V770a_x86_64.deb

The default installation path is /opt/SEGGER

3. Check Out This Repository

git clone https://github.com/IOsetting/hk32f030m-template.git

4. Edit Makefile

Edit Makefile, make sure ARM_TOOCHAIN and JLINKEXE point to the correct paths

##### Project #####
# Project name
PROJECT 		?= app
# Result folder
BUILD_DIR 		= Build

##### Options #####

# Enable printf float %f support, y:yes, n:no
ENABLE_PRINTF_FLOAT	?= y
# Build with FreeRTOS, y:yes, n:no
USE_FREERTOS	?= n
# Build with CMSIS DSP functions, y:yes, n:no
USE_DSP			?= n
# Build with Helix MP3 lib, y:yes, n:no
USE_HELIX		?= n
# Programmer, jlink, stlink, cmsis-dap, pyocd
FLASH_PROGRM    ?= stlink

##### Toolchains #######

ARM_TOOCHAIN 	?= /opt/gcc-arm/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin
# path to st-flash
ST_FLASH		?= st-flash
# path to JLinkExe
JLINKEXE		?= /opt/SEGGER/JLink/JLinkExe
JLINK_DEVICE	?= STM32F103CB
# path to OpenOCD
OPENOCD			?= openocd
# path to PyOCD
PYOCD_EXE		?= pyocd
PYOCD_DEVICE	?= air32f103cb

##### Paths ############

# Link script for current chip
LDSCRIPT		= Libraries/LDScripts/air32f103cbt6.ld

5. Compile and Flash

# Clean
make clean
# Build
make
# Build verbosely
V=1 make
# Flash
make flash

Try Other Examples

More examples can be found in Examples folder, copy and replace the files under User folder to try different examples.