Просмотр исходного кода

revert to use __USE_LPCOPEN

properly init fpu on LPC M4
hathach 5 лет назад
Родитель
Сommit
1cee2da7b9

+ 6 - 3
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

+ 10 - 0
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();

+ 3 - 2
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 \

+ 10 - 0
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));
 

+ 1 - 1
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")))' \

+ 1 - 1
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)))' 

+ 1 - 1
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")))' \

+ 1 - 1
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)))' 

+ 1 - 1
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
 

+ 2 - 0
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));

+ 1 - 1
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
 

+ 6 - 0
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();

+ 1 - 1
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

+ 6 - 0
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));
 

+ 3 - 2
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 \

+ 9 - 3
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));