From ce85e4d98f4916fe64f5d266dd0941e7e066e5bc Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 19 Mar 2014 18:12:51 +0700 Subject: [PATCH] #define SVCall_Handler SVC_Handler in lpcxpresso startup for lpc175x_6x & lpc11uxx for better compatiable with other lib & toolchain. added lpc176x xpresso with cmsis rtx --- boards/embedded_artists/ea4357/board_ea4357.h | 2 +- boards/embedded_artists/oem_base_board/acc.c | 3 + .../oem_base_board/base_eeprom.c | 5 + .../embedded_artists/oem_base_board/lm75a.c | 4 + .../embedded_artists/oem_base_board/memreg.c | 4 + .../oem_base_board/norflash.c | 4 + .../embedded_artists/oem_base_board/uda1380.c | 5 +- demos/host/host_cmsis_rtx/.cproject | 104 +++++++++++++++++- mcu/lpc11uxx/lpcxpresso/cr_startup_lpc11u.c | 1 + mcu/lpc13uxx/lpcxpresso/cr_startup_lpc13u.c | 2 - .../lpcxpresso/cr_startup_lpc176x.c | 2 + tinyusb/host/usbh.c | 2 +- tinyusb/osal/osal_common.h | 2 +- .../cmsis_rtos_rtx/SRC/GCC/RTX_Lib_CM.uvopt | 4 +- vendor/freertos/FreeRTOSConfig_cm3.h | 6 - 15 files changed, 135 insertions(+), 15 deletions(-) diff --git a/boards/embedded_artists/ea4357/board_ea4357.h b/boards/embedded_artists/ea4357/board_ea4357.h index a4bfe9fa5..3c0de9a4e 100644 --- a/boards/embedded_artists/ea4357/board_ea4357.h +++ b/boards/embedded_artists/ea4357/board_ea4357.h @@ -63,7 +63,7 @@ //#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO -#define CFG_PRINTF_TARGET PRINTF_TARGET_UART // FIXME keil's cmsis rtx does not work with UART (work with SWO) +#define CFG_PRINTF_TARGET PRINTF_TARGET_UART #ifdef __cplusplus } diff --git a/boards/embedded_artists/oem_base_board/acc.c b/boards/embedded_artists/oem_base_board/acc.c index bd6a82042..a53634980 100644 --- a/boards/embedded_artists/oem_base_board/acc.c +++ b/boards/embedded_artists/oem_base_board/acc.c @@ -21,7 +21,9 @@ /****************************************************************************** * Includes *****************************************************************************/ +#include "../../board.h" +#if BOARD == BOARD_EA4357 #include "lpc_types.h" #include "lpc43xx_i2c.h" @@ -249,3 +251,4 @@ void acc_setMode(acc_mode_t mode) setModeControl(mctl); } +#endif diff --git a/boards/embedded_artists/oem_base_board/base_eeprom.c b/boards/embedded_artists/oem_base_board/base_eeprom.c index a11070d70..7571744a6 100644 --- a/boards/embedded_artists/oem_base_board/base_eeprom.c +++ b/boards/embedded_artists/oem_base_board/base_eeprom.c @@ -24,6 +24,9 @@ /****************************************************************************** * Includes *****************************************************************************/ +#include "../../board.h" + +#if BOARD == BOARD_EA4357 #include #include @@ -193,3 +196,5 @@ int16_t base_eeprom_write(uint8_t* buf, uint16_t offset, uint16_t len) return written; } + +#endif diff --git a/boards/embedded_artists/oem_base_board/lm75a.c b/boards/embedded_artists/oem_base_board/lm75a.c index 5c8b90171..db8234405 100644 --- a/boards/embedded_artists/oem_base_board/lm75a.c +++ b/boards/embedded_artists/oem_base_board/lm75a.c @@ -24,6 +24,9 @@ /****************************************************************************** * Includes *****************************************************************************/ +#include "../../board.h" + +#if BOARD == BOARD_EA4357 #include #include @@ -126,3 +129,4 @@ int32_t lm75a_readTemp(void) } +#endif diff --git a/boards/embedded_artists/oem_base_board/memreg.c b/boards/embedded_artists/oem_base_board/memreg.c index ef4338bc3..3704f9bb8 100644 --- a/boards/embedded_artists/oem_base_board/memreg.c +++ b/boards/embedded_artists/oem_base_board/memreg.c @@ -21,6 +21,9 @@ /****************************************************************************** * Includes *****************************************************************************/ +#include "../../board.h" + +#if BOARD == BOARD_EA4357 #include "lpc43xx.h" #include "lpc_types.h" @@ -167,4 +170,5 @@ uint32_t memreg_init (void) return FALSE; } +#endif diff --git a/boards/embedded_artists/oem_base_board/norflash.c b/boards/embedded_artists/oem_base_board/norflash.c index 20f1dd8bb..0baf62c49 100644 --- a/boards/embedded_artists/oem_base_board/norflash.c +++ b/boards/embedded_artists/oem_base_board/norflash.c @@ -21,6 +21,9 @@ /****************************************************************************** * Includes *****************************************************************************/ +#include "../../board.h" + +#if BOARD == BOARD_EA4357 #include "lpc_types.h" #include "lpc43xx_scu.h" @@ -541,3 +544,4 @@ uint32_t norflash_secid_writeWord(uint16_t target, uint16_t* data, uint16_t len) return TRUE; } +#endif diff --git a/boards/embedded_artists/oem_base_board/uda1380.c b/boards/embedded_artists/oem_base_board/uda1380.c index 3528ac6e0..654e4eb9a 100644 --- a/boards/embedded_artists/oem_base_board/uda1380.c +++ b/boards/embedded_artists/oem_base_board/uda1380.c @@ -1,3 +1,6 @@ +#include "../../board.h" + +#if BOARD == BOARD_EA4357 #include "lpc43xx_i2c.h" #include "lpc43xx_scu.h" @@ -152,5 +155,5 @@ int32_t Uda1380_ReadData(uint8_t reg, uint16_t *data) return UDA1380_FUNC_ERR; } - +#endif diff --git a/demos/host/host_cmsis_rtx/.cproject b/demos/host/host_cmsis_rtx/.cproject index fa7386f52..812f77897 100644 --- a/demos/host/host_cmsis_rtx/.cproject +++ b/demos/host/host_cmsis_rtx/.cproject @@ -85,7 +85,7 @@ - + @@ -196,6 +196,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mcu/lpc11uxx/lpcxpresso/cr_startup_lpc11u.c b/mcu/lpc11uxx/lpcxpresso/cr_startup_lpc11u.c index 6865b0721..582b71f15 100644 --- a/mcu/lpc11uxx/lpcxpresso/cr_startup_lpc11u.c +++ b/mcu/lpc11uxx/lpcxpresso/cr_startup_lpc11u.c @@ -44,6 +44,7 @@ extern "C" { #define WEAK __attribute__ ((weak)) #define ALIAS(f) __attribute__ ((weak, alias (#f))) +#define SVCall_Handler SVC_Handler // Code Red - if CMSIS is being used, then SystemInit() routine // will be called by startup code rather than in application's main() diff --git a/mcu/lpc13uxx/lpcxpresso/cr_startup_lpc13u.c b/mcu/lpc13uxx/lpcxpresso/cr_startup_lpc13u.c index 5738aac35..8b5d7eebb 100644 --- a/mcu/lpc13uxx/lpcxpresso/cr_startup_lpc13u.c +++ b/mcu/lpc13uxx/lpcxpresso/cr_startup_lpc13u.c @@ -45,8 +45,6 @@ extern "C" { #define WEAK __attribute__ ((weak)) #define ALIAS(f) __attribute__ ((weak, alias (#f))) -#define __USE_CMSIS // Added by nxpUSBlib - // Code Red - if CMSIS is being used, then SystemInit() routine // will be called by startup code rather than in application's main() #if defined (__USE_CMSIS) diff --git a/mcu/lpc175x_6x/lpcxpresso/cr_startup_lpc176x.c b/mcu/lpc175x_6x/lpcxpresso/cr_startup_lpc176x.c index 95f702573..fc6bed580 100644 --- a/mcu/lpc175x_6x/lpcxpresso/cr_startup_lpc176x.c +++ b/mcu/lpc175x_6x/lpcxpresso/cr_startup_lpc176x.c @@ -45,6 +45,8 @@ extern "C" { #define WEAK __attribute__ ((weak)) #define ALIAS(f) __attribute__ ((weak, alias (#f))) +#define SVCall_Handler SVC_Handler + // Code Red - if CMSIS is being used, then SystemInit() routine // will be called by startup code rather than in application's main() #if defined (__USE_CMSIS) diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index 1ff9d365e..13f08719e 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -178,7 +178,7 @@ tusb_error_t usbh_init(void) tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength, uint8_t* data) { - static tusb_error_t error; // FIXME cmsis-rtx use svc for OS API, error value changed after mutex release at the end of function + static tusb_error_t error; // FIXME [CMSIS-RTX] use svc for OS API, error value changed after mutex release at the end of function OSAL_SUBTASK_BEGIN diff --git a/tinyusb/osal/osal_common.h b/tinyusb/osal/osal_common.h index 4c551126c..9add3e877 100644 --- a/tinyusb/osal/osal_common.h +++ b/tinyusb/osal/osal_common.h @@ -59,7 +59,7 @@ enum { OSAL_TIMEOUT_NOTIMEOUT = 0, // for use within ISR, return immediately - OSAL_TIMEOUT_NORMAL = 10*5, // default is 10 msec, FIXME CMSIS-RTX easily timeout with 10 msec + OSAL_TIMEOUT_NORMAL = 10*5, // default is 10 msec, FIXME [CMSIS-RTX] easily timeout with 10 msec OSAL_TIMEOUT_WAIT_FOREVER = 0xFFFFFFFF }; diff --git a/vendor/cmsis_rtos_rtx/SRC/GCC/RTX_Lib_CM.uvopt b/vendor/cmsis_rtos_rtx/SRC/GCC/RTX_Lib_CM.uvopt index 7e1e6f803..8a512d13e 100644 --- a/vendor/cmsis_rtos_rtx/SRC/GCC/RTX_Lib_CM.uvopt +++ b/vendor/cmsis_rtos_rtx/SRC/GCC/RTX_Lib_CM.uvopt @@ -73,7 +73,7 @@ 1 0 - 1 + 0 255 @@ -341,7 +341,7 @@ 1 0 - 0 + 1 255 diff --git a/vendor/freertos/FreeRTOSConfig_cm3.h b/vendor/freertos/FreeRTOSConfig_cm3.h index 0c80d8563..4a79fd0ae 100644 --- a/vendor/freertos/FreeRTOSConfig_cm3.h +++ b/vendor/freertos/FreeRTOSConfig_cm3.h @@ -154,12 +154,6 @@ function can have. Note that lower priority have numerically higher values. */ standard names. */ #define xPortPendSVHandler PendSV_Handler #define xPortSysTickHandler SysTick_Handler - -#ifdef __CODE_RED // cr_startup_lpc176x.c use different name for SVC_Hanlder -#define vPortSVCHandler SVCall_Handler -#else #define vPortSVCHandler SVC_Handler -#endif - #endif /* FREERTOS_CONFIG_H */