Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bsp/airm2m] update:update AIR32F10xLib #7472

Merged
merged 4 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions bsp/airm2m/air32f103/.config
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ CONFIG_RT_USING_MESSAGEQUEUE=y
#
# Memory Management
#
CONFIG_RT_PAGE_MAX_ORDER=11
CONFIG_RT_USING_MEMPOOL=y
CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set
Expand All @@ -82,7 +81,7 @@ CONFIG_RT_USING_DEVICE=y
CONFIG_RT_USING_CONSOLE=y
CONFIG_RT_CONSOLEBUF_SIZE=256
CONFIG_RT_CONSOLE_DEVICE_NAME="uart1"
CONFIG_RT_VER_NUM=0x50000
CONFIG_RT_VER_NUM=0x50001
# CONFIG_RT_USING_STDC_ATOMIC is not set
# CONFIG_RT_USING_CACHE is not set
CONFIG_RT_USING_HW_ATOMIC=y
Expand Down Expand Up @@ -116,6 +115,10 @@ CONFIG_FINSH_USING_DESCRIPTION=y
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
# CONFIG_FINSH_USING_AUTH is not set
CONFIG_FINSH_ARG_MAX=10

#
# DFS: device virtual file system
#
# CONFIG_RT_USING_DFS is not set
# CONFIG_RT_USING_FAL is not set

Expand Down Expand Up @@ -439,6 +442,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_HASH_MATCH is not set
# CONFIG_PKG_USING_ARMV7M_DWT_TOOL is not set
# CONFIG_PKG_USING_VOFA_PLUS is not set
# CONFIG_PKG_USING_RT_TRACE is not set

#
# system packages
Expand Down Expand Up @@ -510,6 +514,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_QPC is not set
# CONFIG_PKG_USING_AGILE_UPGRADE is not set
# CONFIG_PKG_USING_FLASH_BLOB is not set
# CONFIG_PKG_USING_MLIBC is not set

#
# peripheral libraries and drivers
Expand Down Expand Up @@ -664,13 +669,13 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_MISAKA_AT24CXX is not set
# CONFIG_PKG_USING_MISAKA_RGB_BLING is not set
# CONFIG_PKG_USING_LORA_MODEM_DRIVER is not set
# CONFIG_PKG_USING_BL_MCU_SDK is not set
# CONFIG_PKG_USING_SOFT_SERIAL is not set
# CONFIG_PKG_USING_MB85RS16 is not set
# CONFIG_PKG_USING_RFM300 is not set
# CONFIG_PKG_USING_IO_INPUT_FILTER is not set
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
# CONFIG_PKG_USING_LRF_NV7LIDAR is not set
# CONFIG_PKG_USING_AIP650 is not set
# CONFIG_PKG_USING_FINGERPRINT is not set

#
Expand Down
2 changes: 1 addition & 1 deletion bsp/airm2m/air32f103/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Air32F103为系列芯片,首发型号为Air32F103CBT6,其外设和硬件设

该开发板常用 **板载资源** 如下:

- MCU:Air32F103CBT6,主频 216MHz,128K FLASH ,32K RAM
- MCU:Air32F103CBT6,主频 216MHz,128K FLASH ,96K RAM
- 调试下载接口,UART0 To Type-c USB 接口

开发板更多详细信息请参考 [合宙Air32F103开发板 - LuatOS 文档](https://wiki.luatos.com/chips/air32f103/board.html)。
Expand Down
4 changes: 2 additions & 2 deletions bsp/airm2m/air32f103/board/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ extern "C" {
#define AIR32_FLASH_SIZE (128 * 1024)
#define AIR32_FLASH_END_ADDRESS ((uint32_t)(AIR32_FLASH_START_ADRESS + AIR32_FLASH_SIZE))

/* Internal SRAM memory size[Kbytes] , Default: 32*/
#define AIR32_SRAM_SIZE 32
/* Internal SRAM memory size[Kbytes] , Default: 96*/
#define AIR32_SRAM_SIZE 96
#define AIR32_SRAM_END (0x20000000 + AIR32_SRAM_SIZE * 1024)

#if defined(__ARMCC_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ FLASH_Status FLASH_EraseAllBank2Pages(void)
#if defined(__CC_ARM)
__ASM void SetStrt(void)
{
LDR R0, [PC,#0]
MOV R0, PC
LDR R1, [R0,#16]
LDR R1, [R0,#32]
LDR R0, =0x40022010
Expand Down Expand Up @@ -624,6 +624,29 @@ void SetStrt(void)
"BNE FLAGLABLE\n"
"BX lr");
}
#elif defined(__clang__)
__STATIC_INLINE void SetStrt(void)
{
__ASM("MOV R0, PC");
__ASM("LDR R1, [R0,#16]");
__ASM("LDR R1, [R0,#32]");
__ASM("LDR R0, =0x40022010");
__ASM("LDR R1, =0x60");
__ASM("STR R1,[R0]");
__ASM("NOP");
__ASM("NOP");
__ASM("NOP");
__ASM("NOP");
__ASM("NOP");
__ASM("NOP");
__ASM("FLAGLABLE:");
__ASM("LDR R1, =0x4002200C");
__ASM("LDR R2, [R1]");
__ASM("AND R2, #0x01");
__ASM("CMP R2, #0x00");
__ASM("BNE FLAGLABLE");
__ASM("BX lr");
}
#elif defined(__GNUC__)
void SetStrt(void)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdint.h>
#include "air32f10x.h"
#include "air32f10x_rcc_ex.h"

/* ------------ RCC registers bit address in the alias region ----------- */
#define RCC_OFFSET (RCC_BASE - PERIPH_BASE)
Expand Down Expand Up @@ -158,7 +159,6 @@ static __I uint8_t ADCPrescTable[4] = {2, 4, 6, 8};

uint32_t AIR_RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul, FlashClkDiv Latency)
{
volatile uint32_t sramsize = 0;
// uint32_t pllmul = 0;
// FunctionalState pwr_gating_state = 0;
/* Check the parameters */
Expand All @@ -169,15 +169,12 @@ uint32_t AIR_RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul, FlashClk
*(volatile uint32_t *)(0x40016C00) = 0xa7d93a86;//解一、二、三级锁
*(volatile uint32_t *)(0x40016C00) = 0xab12dfcd;
*(volatile uint32_t *)(0x40016C00) = 0xcded3526;
sramsize = *(volatile uint32_t *)(0x40016C18);
*(volatile uint32_t *)(0x40016C18) = 0x200183FF;//配置sram大小, 将BOOT使用对sram打开
*(volatile uint32_t *)(0x4002228C) = 0xa5a5a5a5;//QSPI解锁

SysFreq_Set(RCC_PLLMul,Latency ,0,1);
RCC->CFGR = (RCC->CFGR & ~0x00030000) | RCC_PLLSource;

//恢复配置前状态
// *(volatile uint32_t *)(0x40016C18) = sramsize;
*(volatile uint32_t *)(0x400210F0) = 0;//开启sys_cfg门控
*(volatile uint32_t *)(0x40016C00) = ~0xa7d93a86;//加一、二、三级锁
*(volatile uint32_t *)(0x40016C00) = ~0xab12dfcd;
Expand Down
20 changes: 18 additions & 2 deletions bsp/airm2m/air32f103/libraries/Startup/arm/startup_air32f10x.s
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

Stack_Size EQU 0x00001000
Stack_Size EQU 0x00000400

AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
Expand All @@ -23,7 +23,7 @@ __initial_sp
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

Heap_Size EQU 0x00001000
Heap_Size EQU 0x00000000

AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Expand Down Expand Up @@ -202,6 +202,22 @@ BOOT_RAM PROC
; Reset handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
LDR R0,=0x400210F0
MOV R1,#0x00000001
STR R1,[R0]
LDR R2,=0x40016C00
LDR R3,=0xa7d93a86
STR R3,[R2]
LDR R3,=0xab12dfcd
STR R3,[R2]
LDR R3,=0xcded3526
STR R3,[R2]
LDR R3,=0x200183FF
STR R3,[R2,#0x18]
LDR R4,=0x4002228c
LDR R5,=0xa5a5a5a5
STR R5,[R4]
MOV R1,#0x00000000
IMPORT __main
IMPORT SystemInit
LDR R0, =SystemInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
** File : AIR32F103XB_FLASH.ld
**
** Abstract : Linker script for AIR32F103xB Device with
** 128KByte FLASH, 20KByte RAM
** 128KByte FLASH, 96KByte RAM
**
** Set heap size, stack size and stack location according
** to application requirements.
**
** Set memory bank area and size if external memory is used.
**
** Target : STMicroelectronics AIR32
** Target : AIR32
**
**
** Distribution: The file is distributed as is, without any warranty
Expand Down Expand Up @@ -42,7 +42,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
}

/* Define output sections */
Expand Down
17 changes: 17 additions & 0 deletions bsp/airm2m/air32f103/libraries/Startup/gcc/startup_air32f10x.s
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ LoopFillZerobss:
cmp r2, r4
bcc FillZerobss

ldr r0,=0x400210F0
mov r1,#0x00000001
str r1,[r0]
ldr r2,=0x40016C00
ldr r3,=0xa7d93a86
str r3,[r2]
ldr r3,=0xab12dfcd
str r3,[r2]
ldr r3,=0xcded3526
str r3,[r2]
ldr r3,=0x200183FF
str r3,[r2,#0x18]
ldr r4,=0x4002228c
ldr r5,=0xa5a5a5a5
str r5,[r4]
mov r1,#0x00000000

/* Call the clock system intitialization function.*/
bl SystemInit
/* Call static constructors */
Expand Down
Loading