summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-09-03 12:58:09 +0700
committerhathach <[email protected]>2020-09-03 12:58:09 +0700
commit1cee2da7b920288202f651a4b970e50e05b8786f (patch)
tree9998a1d0d4cf9caeacc84c871009d56c6b335286
parentc7d2d0ae294ca2c93920c86d6cd10a3e74e2b010 (diff)
revert to use __USE_LPCOPEN
properly init fpu on LPC M4
-rw-r--r--hw/bsp/ea4088qs/board.mk9
-rw-r--r--hw/bsp/ea4088qs/ea4088qs.c10
-rw-r--r--hw/bsp/ea4357/board.mk5
-rw-r--r--hw/bsp/ea4357/ea4357.c10
-rw-r--r--hw/bsp/lpcxpresso11u37/board.mk2
-rw-r--r--hw/bsp/lpcxpresso11u68/board.mk2
-rw-r--r--hw/bsp/lpcxpresso1347/board.mk2
-rw-r--r--hw/bsp/lpcxpresso1549/board.mk2
-rw-r--r--hw/bsp/lpcxpresso1769/board.mk2
-rw-r--r--hw/bsp/lpcxpresso1769/lpcxpresso1769.c2
-rw-r--r--hw/bsp/mbed1768/board.mk2
-rw-r--r--hw/bsp/mbed1768/mbed1768.c6
-rw-r--r--hw/bsp/mcb1800/board.mk2
-rw-r--r--hw/bsp/mcb1800/mcb1800.c6
-rw-r--r--hw/bsp/ngx4330/board.mk5
-rw-r--r--hw/bsp/ngx4330/ngx4330.c12
16 files changed, 62 insertions, 17 deletions
diff --git a/hw/bsp/ea4088qs/board.mk b/hw/bsp/ea4088qs/board.mk
index 2a63d8af2..51a6009a0 100644
--- a/hw/bsp/ea4088qs/board.mk
+++ b/hw/bsp/ea4088qs/board.mk
@@ -3,9 +3,11 @@ CFLAGS += \
-mthumb \
-mabi=aapcs \
-mcpu=cortex-m4 \
+ -mfloat-abi=hard \
+ -mfpu=fpv4-sp-d16 \
-nostdlib \
-DCORE_M4 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
-DCFG_TUSB_MCU=OPT_MCU_LPC40XX
@@ -25,7 +27,8 @@ SRC_C += \
$(MCU_DIR)/src/iocon_17xx_40xx.c \
$(MCU_DIR)/src/sysctl_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 += \
$(TOP)/$(MCU_DIR)/inc
@@ -35,7 +38,7 @@ VENDOR = nxp
CHIP_FAMILY = lpc17_40
# For freeRTOS port source
-FREERTOS_PORT = ARM_CM3
+FREERTOS_PORT = ARM_CM4F
# For flash-jlink target
JLINK_DEVICE = LPC4088
diff --git a/hw/bsp/ea4088qs/ea4088qs.c b/hw/bsp/ea4088qs/ea4088qs.c
index 7fc047490..00db1a299 100644
--- a/hw/bsp/ea4088qs/ea4088qs.c
+++ b/hw/bsp/ea4088qs/ea4088qs.c
@@ -86,6 +86,16 @@ static const PINMUX_GRP_T pin_usb_mux[] =
// Invoked by startup code
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_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
Chip_SetupXtalClocking();
diff --git a/hw/bsp/ea4357/board.mk b/hw/bsp/ea4357/board.mk
index 44481118d..3ebe107e2 100644
--- a/hw/bsp/ea4357/board.mk
+++ b/hw/bsp/ea4357/board.mk
@@ -7,7 +7,7 @@ CFLAGS += \
-mfpu=fpv4-sp-d16 \
-nostdlib \
-DCORE_M4 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC43XX
# mcu driver cause following warnings
@@ -26,7 +26,8 @@ SRC_C += \
$(MCU_DIR)/src/sysinit_18xx_43xx.c \
$(MCU_DIR)/src/i2c_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 += \
$(TOP)/$(MCU_DIR)/inc \
diff --git a/hw/bsp/ea4357/ea4357.c b/hw/bsp/ea4357/ea4357.c
index daa3a6bd0..f41ba5ab9 100644
--- a/hw/bsp/ea4357/ea4357.c
+++ b/hw/bsp/ea4357/ea4357.c
@@ -85,6 +85,16 @@ static const PINMUX_GRP_T pinclockmuxing[] =
// Invoked by startup code
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 */
Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
diff --git a/hw/bsp/lpcxpresso11u37/board.mk b/hw/bsp/lpcxpresso11u37/board.mk
index 27019ff8b..d1c48a2e5 100644
--- a/hw/bsp/lpcxpresso11u37/board.mk
+++ b/hw/bsp/lpcxpresso11u37/board.mk
@@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m0 \
-nostdlib \
-DCORE_M0 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
diff --git a/hw/bsp/lpcxpresso11u68/board.mk b/hw/bsp/lpcxpresso11u68/board.mk
index 1c1660367..d9017ae1a 100644
--- a/hw/bsp/lpcxpresso11u68/board.mk
+++ b/hw/bsp/lpcxpresso11u68/board.mk
@@ -6,7 +6,7 @@ CFLAGS += \
-nostdlib \
-DCORE_M0PLUS \
-D__VTOR_PRESENT=0 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM3")))' \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
diff --git a/hw/bsp/lpcxpresso1347/board.mk b/hw/bsp/lpcxpresso1347/board.mk
index 5befc3aee..6dc3937f6 100644
--- a/hw/bsp/lpcxpresso1347/board.mk
+++ b/hw/bsp/lpcxpresso1347/board.mk
@@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \
-nostdlib \
-DCORE_M3 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_LPC13XX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
diff --git a/hw/bsp/lpcxpresso1549/board.mk b/hw/bsp/lpcxpresso1549/board.mk
index c603e4b30..18325c5f7 100644
--- a/hw/bsp/lpcxpresso1549/board.mk
+++ b/hw/bsp/lpcxpresso1549/board.mk
@@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \
-nostdlib \
-DCORE_M3 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_LPC15XX \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
diff --git a/hw/bsp/lpcxpresso1769/board.mk b/hw/bsp/lpcxpresso1769/board.mk
index 6886ef749..a345e5a27 100644
--- a/hw/bsp/lpcxpresso1769/board.mk
+++ b/hw/bsp/lpcxpresso1769/board.mk
@@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \
-nostdlib \
-DCORE_M3 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC175X_6X \
-DRTC_EV_SUPPORT=0
diff --git a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c
index f002e8cdc..5ec4fac23 100644
--- a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c
+++ b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c
@@ -89,9 +89,11 @@ static const PINMUX_GRP_T pin_usb_mux[] =
// Invoked by startup code
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_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
diff --git a/hw/bsp/mbed1768/board.mk b/hw/bsp/mbed1768/board.mk
index 5b23900ff..3bdc8a27a 100644
--- a/hw/bsp/mbed1768/board.mk
+++ b/hw/bsp/mbed1768/board.mk
@@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \
-nostdlib \
-DCORE_M3 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC175X_6X \
-DRTC_EV_SUPPORT=0
diff --git a/hw/bsp/mbed1768/mbed1768.c b/hw/bsp/mbed1768/mbed1768.c
index 5963ad8ec..0dfd05c81 100644
--- a/hw/bsp/mbed1768/mbed1768.c
+++ b/hw/bsp/mbed1768/mbed1768.c
@@ -65,6 +65,12 @@ static const PINMUX_GRP_T pin_usb_mux[] =
// Invoked by startup code
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_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
Chip_SetupXtalClocking();
diff --git a/hw/bsp/mcb1800/board.mk b/hw/bsp/mcb1800/board.mk
index 3d3bb2371..e3f07d0d0 100644
--- a/hw/bsp/mcb1800/board.mk
+++ b/hw/bsp/mcb1800/board.mk
@@ -5,7 +5,7 @@ CFLAGS += \
-mcpu=cortex-m3 \
-nostdlib \
-DCORE_M3 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC18XX
# mcu driver cause following warnings
diff --git a/hw/bsp/mcb1800/mcb1800.c b/hw/bsp/mcb1800/mcb1800.c
index 1d7ffb35f..b57385985 100644
--- a/hw/bsp/mcb1800/mcb1800.c
+++ b/hw/bsp/mcb1800/mcb1800.c
@@ -112,6 +112,12 @@ static const PINMUX_GRP_T pinclockmuxing[] =
// Invoked by startup code
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 */
Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
diff --git a/hw/bsp/ngx4330/board.mk b/hw/bsp/ngx4330/board.mk
index 23d53bd18..fe66fceb5 100644
--- a/hw/bsp/ngx4330/board.mk
+++ b/hw/bsp/ngx4330/board.mk
@@ -7,7 +7,7 @@ CFLAGS += \
-mfpu=fpv4-sp-d16 \
-nostdlib \
-DCORE_M4 \
- -D__USE_CMSIS \
+ -D__USE_LPCOPEN \
-DCFG_TUSB_MCU=OPT_MCU_LPC43XX
# mcu driver cause following warnings
@@ -24,7 +24,8 @@ SRC_C += \
$(MCU_DIR)/src/clock_18xx_43xx.c \
$(MCU_DIR)/src/gpio_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 += \
$(TOP)/$(MCU_DIR)/inc \
diff --git a/hw/bsp/ngx4330/ngx4330.c b/hw/bsp/ngx4330/ngx4330.c
index 5296ddcb3..b1908fc38 100644
--- a/hw/bsp/ngx4330/ngx4330.c
+++ b/hw/bsp/ngx4330/ngx4330.c
@@ -71,11 +71,17 @@ static const PINMUX_GRP_T pinmuxing[] =
};
// Invoked by startup code
-extern void (* const g_pfnVectors[])(void);
void SystemInit(void)
{
- // Remap isr vector
- *((uint32_t *) 0xE000ED08) = (uint32_t) &g_pfnVectors;
+#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
// Set up pinmux
Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));