[BSP][airm2m] 同步lib修改,包括sram加锁、修复获取rtc频率错误等 (#7718)

This commit is contained in:
Dozingfiretruck
2023-06-27 10:41:59 +08:00
committed by GitHub
parent ce4a9c324d
commit 78dcc3d2c8
6 changed files with 498 additions and 90 deletions

View File

@@ -14,7 +14,7 @@
## 开发板介绍
Air32F103为系列芯片首发型号为Air32F103CBT6其外设和硬件设计兼容市场上一些主流F103型号主频最高可达216M32K RAM+128K Flash每个IO都可设置独立的内部上下拉电阻。
Air32F103为系列芯片首发型号为Air32F103CBT6其外设和硬件设计兼容市场上一些主流F103型号主频最高可达216M96K RAM+128K Flash每个IO都可设置独立的内部上下拉电阻。
开发板外观如下图所示:

View File

@@ -296,7 +296,7 @@ void FLASH_Unlock(void)
FLASH->KEYR = FLASH_KEY1;
FLASH->KEYR = FLASH_KEY2;
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/* Authorize the FPEC of Bank2 Access */
FLASH->KEYR2 = FLASH_KEY1;
FLASH->KEYR2 = FLASH_KEY2;
@@ -318,7 +318,7 @@ void FLASH_UnlockBank1(void)
FLASH->KEYR = FLASH_KEY2;
}
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/**
* @brief Unlocks the FLASH Bank2 Program Erase Controller.
* @note This function can be used only for AIR32F10X_XL density devices.
@@ -348,7 +348,7 @@ void FLASH_Lock(void)
/* Set the Lock Bit to lock the FPEC and the CR of Bank1 */
FLASH->CR |= CR_LOCK_Set;
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/* Set the Lock Bit to lock the FPEC and the CR of Bank2 */
FLASH->CR2 |= CR_LOCK_Set;
#endif /* AIR32F10X_XL */
@@ -369,7 +369,7 @@ void FLASH_LockBank1(void)
FLASH->CR |= CR_LOCK_Set;
}
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/**
* @brief Locks the FLASH Bank2 Program Erase Controller.
* @note This function can be used only for AIR32F10X_XL density devices.
@@ -396,7 +396,7 @@ FLASH_Status FLASH_ErasePage(uint32_t Page_Address)
/* Check the parameters */
assert_param(IS_FLASH_ADDRESS(Page_Address));
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
if(Page_Address < FLASH_BANK1_END_ADDRESS)
{
/* Wait for last operation to be completed */
@@ -467,7 +467,7 @@ FLASH_Status FLASH_EraseAllPages(void)
{
FLASH_Status status = FLASH_COMPLETE;
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/* Wait for last operation to be completed */
status = FLASH_WaitForLastBank1Operation(EraseTimeout);
@@ -548,7 +548,7 @@ FLASH_Status FLASH_EraseAllBank1Pages(void)
return status;
}
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/**
* @brief Erases all Bank2 FLASH pages.
* @note This function can be used only for AIR32F103_XL density devices.
@@ -754,7 +754,7 @@ FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data)
/* Check the parameters */
assert_param(IS_FLASH_ADDRESS(Address));
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
if(Address < FLASH_BANK1_END_ADDRESS - 2)
{
/* Wait for last operation to be completed */
@@ -929,7 +929,7 @@ FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data)
/* Check the parameters */
assert_param(IS_FLASH_ADDRESS(Address));
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation(ProgramTimeout);
@@ -1222,7 +1222,7 @@ FLASH_Status FLASH_UserOptionByteConfig(uint16_t OB_IWDG, uint16_t OB_STOP, uint
return status;
}
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/**
* @brief Configures to boot from Bank1 or Bank2.
* @note This function can be used only for AIR32F103_XL density devices.
@@ -1361,7 +1361,7 @@ FlagStatus FLASH_GetPrefetchBufferStatus(void)
*/
void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState)
{
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/* Check the parameters */
assert_param(IS_FLASH_IT(FLASH_IT));
assert_param(IS_FUNCTIONAL_STATE(NewState));
@@ -1430,7 +1430,7 @@ FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
{
FlagStatus bitstatus = RESET;
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/* Check the parameters */
assert_param(IS_FLASH_GET_FLAG(FLASH_FLAG)) ;
if(FLASH_FLAG == FLASH_FLAG_OPTERR)
@@ -1514,7 +1514,7 @@ FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
*/
void FLASH_ClearFlag(uint32_t FLASH_FLAG)
{
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/* Check the parameters */
assert_param(IS_FLASH_CLEAR_FLAG(FLASH_FLAG)) ;
@@ -1614,7 +1614,7 @@ FLASH_Status FLASH_GetBank1Status(void)
return flashstatus;
}
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/**
* @brief Returns the FLASH Bank2 Status.
* @note This function can be used for AIR32F103_XL density devices.
@@ -1712,7 +1712,7 @@ FLASH_Status FLASH_WaitForLastBank1Operation(uint32_t Timeout)
return status;
}
#ifdef AIR32F10X_XL
#if defined(AIR32F10X_XL) || defined(AIR32F10X_MD_1024K)
/**
* @brief Waits for a Flash operation on Bank2 to complete or a TIMEOUT to occur.
* @note This function can be used only for AIR32F103_XL density devices.

View File

@@ -89,7 +89,7 @@
#define CFGR_PPRE2_Reset_Mask ((uint32_t)0xFFFFC7FF)
#define CFGR_PPRE2_Set_Mask ((uint32_t)0x00003800)
#define CFGR_ADCPRE_Reset_Mask ((uint32_t)0x9FFF3FFF)
#define CFGR_ADCPRE_Set_Mask ((uint32_t)0x0000C000)
#define CFGR_ADCPRE_Set_Mask ((uint32_t)0x6000C000)
/* CSR register bit mask */
#define CSR_RMVF_Set ((uint32_t)0x01000000)
@@ -126,7 +126,7 @@
*/
static __I uint8_t APBAHBPrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9};
static __I uint8_t ADCPrescTable[4] = {2, 4, 6, 8};
static __I uint8_t ADCPrescTable[16] = {2, 4, 6, 8, 16, 32, 36, 48, 64, 72, 96, 120, 144, 168, 192 ,216};
/**
* @}
@@ -682,7 +682,7 @@ void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks)
RCC_Clocks->PCLK2_Frequency = RCC_Clocks->HCLK_Frequency >> presc;
/* Get ADCCLK prescaler */
tmp = RCC->CFGR & CFGR_ADCPRE_Set_Mask;
tmp = tmp >> 14;
tmp = ((tmp >> 27) | (tmp >> 14)) & 0x0F;
presc = ADCPrescTable[tmp];
/* ADCCLK clock frequency */
RCC_Clocks->ADCCLK_Frequency = RCC_Clocks->PCLK2_Frequency / presc;

View File

@@ -118,70 +118,70 @@ __Vectors DCD __initial_sp ; Top of Stack
DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SYMC_IRQHandler
DCD RNG_IRQHandler
DCD SENSOR_IRQHandler
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
;DCD 0X20005000
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
;DCD 0X20005000
;DCD BOOT_RAM
__Vectors_End
__Vectors_Size EQU __Vectors_End - __Vectors
@@ -189,7 +189,7 @@ __Vectors_Size EQU __Vectors_End - __Vectors
AREA |.text|, CODE, READONLY
;
BOOT_RAM PROC
BOOT_RAM PROC
EXPORT BOOT_RAM [WEAK]
IMPORT __main
IMPORT SystemInit
@@ -198,14 +198,14 @@ BOOT_RAM PROC
LDR R0, =__main
BX R0
ENDP
; Reset handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
LDR R0,=0x400210F0
LDR R0,=0x400210F0
MOV R1,#0x00000001
STR R1,[R0]
LDR R2,=0x40016C00
LDR R2,=0x40016C00
LDR R3,=0xa7d93a86
STR R3,[R2]
LDR R3,=0xab12dfcd
@@ -217,6 +217,20 @@ Reset_Handler PROC
LDR R4,=0x4002228c
LDR R5,=0xa5a5a5a5
STR R5,[R4]
;lock
LDR R2,=0x400210F0
LDR R3,=0x00000000
STR R3,[R2]
LDR R2,=0x40016C00
LDR R3,=0x5826c579
STR R3,[R2]
LDR R3,=0x54ed2032
STR R3,[R2]
LDR R3,=0x3212cad9
STR R3,[R2]
LDR R2,=0x4002228c
LDR R3,=0x5a5a5a5a
STR R3,[R2]
MOV R1,#0x00000000
IMPORT __main
IMPORT SystemInit

View File

@@ -65,7 +65,7 @@ FillZerobss:
LoopFillZerobss:
cmp r2, r4
bcc FillZerobss
/*unlock*/
ldr r0,=0x400210F0
mov r1,#0x00000001
str r1,[r0]
@@ -81,6 +81,21 @@ LoopFillZerobss:
ldr r4,=0x4002228c
ldr r5,=0xa5a5a5a5
str r5,[r4]
/*lock*/
ldr r2,=0x400210f0
ldr r3,=0x00000000
str r3,[r2]
ldr r2,=0x40016c00
ldr r3,=0x5826c579
str r3,[r2]
ldr r3,=0x54ed2032
str r3,[r2]
ldr r3,=0x3212cad9
str r3,[r2]
ldr r2,=0x4002228c
ldr r3,=0x5a5a5a5a
str r3,[r2]
mov r1,#0x00000000
/* Call the clock system intitialization function.*/