revert to use __USE_LPCOPEN

properly init fpu on LPC M4
This commit is contained in:
hathach 2020-09-03 12:58:09 +07:00
parent c7d2d0ae29
commit 1cee2da7b9
16 changed files with 62 additions and 17 deletions

View File

@ -3,9 +3,11 @@ CFLAGS += \
-mthumb \ -mthumb \
-mabi=aapcs \ -mabi=aapcs \
-mcpu=cortex-m4 \ -mcpu=cortex-m4 \
-mfloat-abi=hard \
-mfpu=fpv4-sp-d16 \
-nostdlib \ -nostdlib \
-DCORE_M4 \ -DCORE_M4 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \ -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
-DCFG_TUSB_MCU=OPT_MCU_LPC40XX -DCFG_TUSB_MCU=OPT_MCU_LPC40XX
@ -25,7 +27,8 @@ SRC_C += \
$(MCU_DIR)/src/iocon_17xx_40xx.c \ $(MCU_DIR)/src/iocon_17xx_40xx.c \
$(MCU_DIR)/src/sysctl_17xx_40xx.c \ $(MCU_DIR)/src/sysctl_17xx_40xx.c \
$(MCU_DIR)/src/sysinit_17xx_40xx.c \ $(MCU_DIR)/src/sysinit_17xx_40xx.c \
$(MCU_DIR)/src/uart_17xx_40xx.c $(MCU_DIR)/src/uart_17xx_40xx.c \
$(MCU_DIR)/src/fpu_init.c
INC += \ INC += \
$(TOP)/$(MCU_DIR)/inc $(TOP)/$(MCU_DIR)/inc
@ -35,7 +38,7 @@ VENDOR = nxp
CHIP_FAMILY = lpc17_40 CHIP_FAMILY = lpc17_40
# For freeRTOS port source # For freeRTOS port source
FREERTOS_PORT = ARM_CM3 FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC4088 JLINK_DEVICE = LPC4088

View File

@ -86,6 +86,16 @@ static const PINMUX_GRP_T pin_usb_mux[] =
// Invoked by startup code // Invoked by startup code
void SystemInit(void) void SystemInit(void)
{ {
#ifdef __USE_LPCOPEN
extern void (* const g_pfnVectors[])(void);
unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;
*pSCB_VTOR = (unsigned int) &g_pfnVectors;
#if __FPU_USED == 1
fpuInit();
#endif
#endif // __USE_LPCOPEN
Chip_IOCON_Init(LPC_IOCON); Chip_IOCON_Init(LPC_IOCON);
Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T)); Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
Chip_SetupXtalClocking(); Chip_SetupXtalClocking();

View File

@ -7,7 +7,7 @@ CFLAGS += \
-mfpu=fpv4-sp-d16 \ -mfpu=fpv4-sp-d16 \
-nostdlib \ -nostdlib \
-DCORE_M4 \ -DCORE_M4 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC43XX -DCFG_TUSB_MCU=OPT_MCU_LPC43XX
# mcu driver cause following warnings # mcu driver cause following warnings
@ -26,7 +26,8 @@ SRC_C += \
$(MCU_DIR)/src/sysinit_18xx_43xx.c \ $(MCU_DIR)/src/sysinit_18xx_43xx.c \
$(MCU_DIR)/src/i2c_18xx_43xx.c \ $(MCU_DIR)/src/i2c_18xx_43xx.c \
$(MCU_DIR)/src/i2cm_18xx_43xx.c \ $(MCU_DIR)/src/i2cm_18xx_43xx.c \
$(MCU_DIR)/src/uart_18xx_43xx.c $(MCU_DIR)/src/uart_18xx_43xx.c \
$(MCU_DIR)/src/fpu_init.c
INC += \ INC += \
$(TOP)/$(MCU_DIR)/inc \ $(TOP)/$(MCU_DIR)/inc \

View File

@ -85,6 +85,16 @@ static const PINMUX_GRP_T pinclockmuxing[] =
// Invoked by startup code // Invoked by startup code
void SystemInit(void) void SystemInit(void)
{ {
#ifdef __USE_LPCOPEN
extern void (* const g_pfnVectors[])(void);
unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;
*pSCB_VTOR = (unsigned int) &g_pfnVectors;
#if __FPU_USED == 1
fpuInit();
#endif
#endif // __USE_LPCOPEN
/* Setup system level pin muxing */ /* Setup system level pin muxing */
Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T)); Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));

View File

@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m0 \ -mcpu=cortex-m0 \
-nostdlib \ -nostdlib \
-DCORE_M0 \ -DCORE_M0 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_EXAMPLE_MSC_READONLY \ -DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \ -DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \ -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \

View File

@ -6,7 +6,7 @@ CFLAGS += \
-nostdlib \ -nostdlib \
-DCORE_M0PLUS \ -DCORE_M0PLUS \
-D__VTOR_PRESENT=0 \ -D__VTOR_PRESENT=0 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \ -DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM3")))' \ -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM3")))' \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'

View File

@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \ -mcpu=cortex-m3 \
-nostdlib \ -nostdlib \
-DCORE_M3 \ -DCORE_M3 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_EXAMPLE_MSC_READONLY \ -DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_LPC13XX \ -DCFG_TUSB_MCU=OPT_MCU_LPC13XX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \ -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \

View File

@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \ -mcpu=cortex-m3 \
-nostdlib \ -nostdlib \
-DCORE_M3 \ -DCORE_M3 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_EXAMPLE_MSC_READONLY \ -DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_LPC15XX \ -DCFG_TUSB_MCU=OPT_MCU_LPC15XX \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'

View File

@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \ -mcpu=cortex-m3 \
-nostdlib \ -nostdlib \
-DCORE_M3 \ -DCORE_M3 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC175X_6X \ -DCFG_TUSB_MCU=OPT_MCU_LPC175X_6X \
-DRTC_EV_SUPPORT=0 -DRTC_EV_SUPPORT=0

View File

@ -89,9 +89,11 @@ static const PINMUX_GRP_T pin_usb_mux[] =
// Invoked by startup code // Invoked by startup code
void SystemInit(void) void SystemInit(void)
{ {
#ifdef __USE_LPCOPEN
extern void (* const g_pfnVectors[])(void); extern void (* const g_pfnVectors[])(void);
unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08; unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;
*pSCB_VTOR = (unsigned int) &g_pfnVectors; *pSCB_VTOR = (unsigned int) &g_pfnVectors;
#endif
Chip_IOCON_Init(LPC_IOCON); Chip_IOCON_Init(LPC_IOCON);
Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T)); Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));

View File

@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \ -mcpu=cortex-m3 \
-nostdlib \ -nostdlib \
-DCORE_M3 \ -DCORE_M3 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC175X_6X \ -DCFG_TUSB_MCU=OPT_MCU_LPC175X_6X \
-DRTC_EV_SUPPORT=0 -DRTC_EV_SUPPORT=0

View File

@ -65,6 +65,12 @@ static const PINMUX_GRP_T pin_usb_mux[] =
// Invoked by startup code // Invoked by startup code
void SystemInit(void) void SystemInit(void)
{ {
#ifdef __USE_LPCOPEN
extern void (* const g_pfnVectors[])(void);
unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;
*pSCB_VTOR = (unsigned int) &g_pfnVectors;
#endif
Chip_IOCON_Init(LPC_IOCON); Chip_IOCON_Init(LPC_IOCON);
Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T)); Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
Chip_SetupXtalClocking(); Chip_SetupXtalClocking();

View File

@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \ -mcpu=cortex-m3 \
-nostdlib \ -nostdlib \
-DCORE_M3 \ -DCORE_M3 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC18XX -DCFG_TUSB_MCU=OPT_MCU_LPC18XX
# mcu driver cause following warnings # mcu driver cause following warnings

View File

@ -112,6 +112,12 @@ static const PINMUX_GRP_T pinclockmuxing[] =
// Invoked by startup code // Invoked by startup code
void SystemInit(void) void SystemInit(void)
{ {
#ifdef __USE_LPCOPEN
extern void (* const g_pfnVectors[])(void);
unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;
*pSCB_VTOR = (unsigned int) &g_pfnVectors;
#endif
/* Setup system level pin muxing */ /* Setup system level pin muxing */
Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T)); Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));

View File

@ -7,7 +7,7 @@ CFLAGS += \
-mfpu=fpv4-sp-d16 \ -mfpu=fpv4-sp-d16 \
-nostdlib \ -nostdlib \
-DCORE_M4 \ -DCORE_M4 \
-D__USE_CMSIS \ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC43XX -DCFG_TUSB_MCU=OPT_MCU_LPC43XX
# mcu driver cause following warnings # mcu driver cause following warnings
@ -24,7 +24,8 @@ SRC_C += \
$(MCU_DIR)/src/clock_18xx_43xx.c \ $(MCU_DIR)/src/clock_18xx_43xx.c \
$(MCU_DIR)/src/gpio_18xx_43xx.c \ $(MCU_DIR)/src/gpio_18xx_43xx.c \
$(MCU_DIR)/src/sysinit_18xx_43xx.c \ $(MCU_DIR)/src/sysinit_18xx_43xx.c \
$(MCU_DIR)/src/uart_18xx_43xx.c $(MCU_DIR)/src/uart_18xx_43xx.c \
$(MCU_DIR)/src/fpu_init.c
INC += \ INC += \
$(TOP)/$(MCU_DIR)/inc \ $(TOP)/$(MCU_DIR)/inc \

View File

@ -71,11 +71,17 @@ static const PINMUX_GRP_T pinmuxing[] =
}; };
// Invoked by startup code // Invoked by startup code
extern void (* const g_pfnVectors[])(void);
void SystemInit(void) void SystemInit(void)
{ {
// Remap isr vector #ifdef __USE_LPCOPEN
*((uint32_t *) 0xE000ED08) = (uint32_t) &g_pfnVectors; extern void (* const g_pfnVectors[])(void);
unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;
*pSCB_VTOR = (unsigned int) &g_pfnVectors;
#if __FPU_USED == 1
fpuInit();
#endif
#endif // __USE_LPCOPEN
// Set up pinmux // Set up pinmux
Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T)); Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));