mirror of https://github.com/ARMmbed/mbed-os.git
[NANO130] Fix issues in OS 5.5 Greentea test
1. Support CMSIS_VECTAB_VIRTUAL feature 2. Reduce the register sync waiting time in LP ticker 3. Adjust the stack and heap size in GCC and IAR toolchainspull/4631/head
parent
bc0fc2ea4e
commit
6c870ca65f
|
@ -671,8 +671,8 @@ extern "C" int errno;
|
|||
#if defined(TARGET_NUVOTON)
|
||||
// Overwrite _sbrk() to support two region model (heap and stack are two distinct regions).
|
||||
// __wrap__sbrk() is implemented in:
|
||||
// TARGET_NUMAKER_PFM_NUC472 hal/targets/cmsis/TARGET_NUVOTON/TARGET_NUC472/TARGET_NUMAKER_PFM_NUC472/TOOLCHAIN_GCC_ARM/retarget.c
|
||||
// TARGET_NUMAKER_PFM_M453 hal/targets/cmsis/TARGET_NUVOTON/TARGET_M451/TARGET_NUMAKER_PFM_M453/TOOLCHAIN_GCC_ARM/retarget.c
|
||||
// TARGET_NUMAKER_PFM_NUC472 targets/TARGET_NUVOTON/TARGET_NUC472/TARGET_NUMAKER_PFM_NUC472/TOOLCHAIN_GCC_ARM/nuc472_retarget.c
|
||||
// TARGET_NUMAKER_PFM_M453 targets/TARGET_NUVOTON/TARGET_M451/TARGET_NUMAKER_PFM_M453/TOOLCHAIN_GCC_ARM/m451_retarget.c
|
||||
extern "C" void *__wrap__sbrk(int incr);
|
||||
extern "C" caddr_t _sbrk(int incr) {
|
||||
return (caddr_t) __wrap__sbrk(incr);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Nuvoton NANO130 GCC linker script file
|
||||
*/
|
||||
|
||||
StackSize = 0x800;
|
||||
StackSize = 0x600;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ define symbol __ICFEDIT_region_IRAM_start__ = 0x20000000;
|
|||
define symbol __ICFEDIT_region_IRAM_end__ = 0x20004000 - 1;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x800;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x1800;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x1200;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2015-2017 Nuvoton
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "cmsis_nvic.h"
|
||||
#include "platform/mbed_error.h"
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
|
||||
{
|
||||
// NOTE: On NANO130, relocating vector table is not supported due to just 16KB small SRAM.
|
||||
// Add guard code to prevent from unsupported relocating.
|
||||
uint32_t vector_static = NVIC_GetVector(IRQn);
|
||||
if (vector_static != vector) {
|
||||
error("No support for relocating vector table");
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn)
|
||||
{
|
||||
uint32_t *vectors = (uint32_t*) NVIC_FLASH_VECTOR_ADDRESS;
|
||||
|
||||
// Return the vector
|
||||
return vectors[IRQn + 16];
|
||||
}
|
|
@ -33,4 +33,31 @@
|
|||
#endif
|
||||
|
||||
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Set the ISR for IRQn
|
||||
*
|
||||
* Sets an Interrupt Service Routine vector for IRQn; if the feature is available, the vector table is relocated to SRAM
|
||||
* the first time this function is called
|
||||
* @param[in] IRQn The Interrupt Request number for which a vector will be registered
|
||||
* @param[in] vector The ISR vector to register for IRQn
|
||||
*/
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
|
||||
|
||||
/** Get the ISR registered for IRQn
|
||||
*
|
||||
* Reads the Interrupt Service Routine currently registered for IRQn
|
||||
* @param[in] IRQn The Interrupt Request number the vector of which will be read
|
||||
* @return Returns the ISR registered for IRQn
|
||||
*/
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "nu_modutil.h"
|
||||
#include "nu_miscutil.h"
|
||||
#include "mbed_critical.h"
|
||||
#include "mbed_wait_api.h"
|
||||
|
||||
// lp_ticker tick = us = timestamp
|
||||
#define US_PER_TICK (1)
|
||||
|
@ -219,9 +220,6 @@ static void lp_ticker_arm_cd(void)
|
|||
uint32_t ctl_timer3 = timer3_base->CTL;
|
||||
ctl_timer3 &= ~TIMER_CTL_MODE_SEL_Msk;
|
||||
ctl_timer3 |= TIMER_ONESHOT_MODE;
|
||||
// Wait 3 cycles of engine clock to ensure previous CTL write action is finish
|
||||
nu_nop(SystemCoreClock / __LXT * 3);
|
||||
timer3_base->CTL = ctl_timer3;
|
||||
timer3_base->PRECNT = prescale_timer3;
|
||||
|
||||
cd_minor_clks = cd_major_minor_clks;
|
||||
|
@ -230,8 +228,8 @@ static void lp_ticker_arm_cd(void)
|
|||
|
||||
TIMER_EnableInt(timer3_base);
|
||||
TIMER_EnableWakeup((TIMER_T *) NU_MODBASE(timer3_modinit.modname));
|
||||
// Wait 3 cycles of engine clock to ensure previous CTL write action is finish
|
||||
nu_nop(SystemCoreClock / __LXT * 3);
|
||||
TIMER_Start(timer3_base);
|
||||
// Wait 2 cycles of engine clock to ensure previous CTL write action is finish
|
||||
wait_us(30 * 2);
|
||||
timer3_base->CTL = ctl_timer3 | TIMER_CTL_TMR_EN_Msk;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(TARGET_NUMAKER_PFM_NUC472)
|
||||
#if defined(TARGET_NUVOTON)
|
||||
|
||||
#if defined(__CC_ARM)
|
||||
extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Base[];
|
||||
|
@ -45,68 +45,6 @@
|
|||
#error "no toolchain defined"
|
||||
#endif
|
||||
|
||||
#elif defined(TARGET_NUMAKER_PFM_M453)
|
||||
|
||||
#if defined(__CC_ARM)
|
||||
extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Base[];
|
||||
extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Length[];
|
||||
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
|
||||
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
|
||||
#define HEAP_START ((unsigned char*) Image$$ARM_LIB_HEAP$$ZI$$Base)
|
||||
#define HEAP_SIZE ((uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Length)
|
||||
#define ISR_STACK_START ((unsigned char*)Image$$ARM_LIB_STACK$$ZI$$Base)
|
||||
#define ISR_STACK_SIZE ((uint32_t)Image$$ARM_LIB_STACK$$ZI$$Length)
|
||||
#elif defined(__GNUC__)
|
||||
extern uint32_t __StackTop[];
|
||||
extern uint32_t __StackLimit[];
|
||||
extern uint32_t __end__[];
|
||||
extern uint32_t __HeapLimit[];
|
||||
#define HEAP_START ((unsigned char*)__end__)
|
||||
#define HEAP_SIZE ((uint32_t)((uint32_t)__HeapLimit - (uint32_t)HEAP_START))
|
||||
#define ISR_STACK_START ((unsigned char*)__StackLimit)
|
||||
#define ISR_STACK_SIZE ((uint32_t)((uint32_t)__StackTop - (uint32_t)__StackLimit))
|
||||
#elif defined(__ICCARM__)
|
||||
/* No region declarations needed */
|
||||
#else
|
||||
#error "no toolchain defined"
|
||||
#endif
|
||||
|
||||
#elif defined(TARGET_NUMAKER_PFM_NANO130)
|
||||
|
||||
#ifndef OS_TASKCNT
|
||||
#define OS_TASKCNT 6
|
||||
#endif
|
||||
#ifndef OS_MAINSTKSIZE
|
||||
#define OS_MAINSTKSIZE 128
|
||||
#endif
|
||||
#ifndef OS_CLOCK
|
||||
#define OS_CLOCK 42000000
|
||||
#endif
|
||||
|
||||
#if defined(__CC_ARM)
|
||||
extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Base[];
|
||||
extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Length[];
|
||||
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
|
||||
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
|
||||
#define HEAP_START ((unsigned char*) Image$$ARM_LIB_HEAP$$ZI$$Base)
|
||||
#define HEAP_SIZE ((uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Length)
|
||||
#define ISR_STACK_START ((unsigned char*)Image$$ARM_LIB_STACK$$ZI$$Base)
|
||||
#define ISR_STACK_SIZE ((uint32_t)Image$$ARM_LIB_STACK$$ZI$$Length)
|
||||
#elif defined(__GNUC__)
|
||||
extern uint32_t __StackTop[];
|
||||
extern uint32_t __StackLimit[];
|
||||
extern uint32_t __end__[];
|
||||
extern uint32_t __HeapLimit[];
|
||||
#define HEAP_START ((unsigned char*)__end__)
|
||||
#define HEAP_SIZE ((uint32_t)((uint32_t)__HeapLimit - (uint32_t)HEAP_START))
|
||||
#define ISR_STACK_START ((unsigned char*)__StackLimit)
|
||||
#define ISR_STACK_SIZE ((uint32_t)((uint32_t)__StackTop - (uint32_t)__StackLimit))
|
||||
#elif defined(__ICCARM__)
|
||||
/* No region declarations needed */
|
||||
#else
|
||||
#error "no toolchain defined"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // TARGET_NUVOTON
|
||||
|
||||
#endif // MBED_MBED_RTX_H
|
||||
|
|
|
@ -2920,6 +2920,7 @@
|
|||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"inherits": ["Target"],
|
||||
"progen": {"target": "numaker-pfm-nano130"},
|
||||
"macros": ["CMSIS_VECTAB_VIRTUAL", "CMSIS_VECTAB_VIRTUAL_HEADER_FILE=\"cmsis_nvic.h\""],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "STDIO_MESSAGES", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH"],
|
||||
"release_versions": ["5"],
|
||||
"device_name": "NANO130KE3BN"
|
||||
|
|
Loading…
Reference in New Issue