mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Update mbed OS to handle ARMC6 requirements
							parent
							
								
									1fef5553b4
								
							
						
					
					
						commit
						922bf1b619
					
				| 
						 | 
				
			
			@ -51,7 +51,7 @@
 | 
			
		|||
/* Use LWIP error codes */
 | 
			
		||||
#define LWIP_PROVIDE_ERRNO
 | 
			
		||||
 | 
			
		||||
#if defined(__arm__) && defined(__ARMCC_VERSION) 
 | 
			
		||||
#if defined(__arm__) && defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050)
 | 
			
		||||
    /* Keil uVision4 tools */
 | 
			
		||||
    #define PACK_STRUCT_BEGIN __packed
 | 
			
		||||
    #define PACK_STRUCT_STRUCT
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -165,7 +165,7 @@ typedef struct _ARM_CFSTORE_STATUS {
 | 
			
		|||
    ARM_CFSTORE_HANDLE (__name) = (ARM_CFSTORE_HANDLE) (__name##_buf_cFsToRe);  \
 | 
			
		||||
    memset((__name##_buf_cFsToRe), 0, CFSTORE_HANDLE_BUFSIZE)
 | 
			
		||||
 | 
			
		||||
#if defined __MBED__ && defined TOOLCHAIN_GCC_ARM
 | 
			
		||||
#if defined __MBED__ && (defined TOOLCHAIN_GCC_ARM || defined TOOLCHAIN_ARMC6)
 | 
			
		||||
/** @brief  Helper macro to swap 2 handles, which is useful for the Find() idiom. */
 | 
			
		||||
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe)         \
 | 
			
		||||
    do{ ARM_CFSTORE_HANDLE __temp_HaNdLe = (__a_HaNdLe);    \
 | 
			
		||||
| 
						 | 
				
			
			@ -175,9 +175,8 @@ typedef struct _ARM_CFSTORE_STATUS {
 | 
			
		|||
        (__b_HaNdLe) = (__temp_HaNdLe);                     \
 | 
			
		||||
        __asm volatile("" ::: "memory");                    \
 | 
			
		||||
    }while(0)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined __MBED__ && defined TOOLCHAIN_ARM
 | 
			
		||||
#elif defined __MBED__ && defined TOOLCHAIN_ARM
 | 
			
		||||
/** @brief  Helper macro to swap 2 handles, which is useful for the Find() idiom. */
 | 
			
		||||
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe)         \
 | 
			
		||||
    do{ ARM_CFSTORE_HANDLE __temp_HaNdLe = (__a_HaNdLe);    \
 | 
			
		||||
| 
						 | 
				
			
			@ -187,9 +186,8 @@ typedef struct _ARM_CFSTORE_STATUS {
 | 
			
		|||
        (__b_HaNdLe) = (__temp_HaNdLe);                     \
 | 
			
		||||
        __dmb(0xf);                                         \
 | 
			
		||||
    }while(0)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined __MBED__ && defined __ICCARM__
 | 
			
		||||
#elif defined __MBED__ && defined TOOLCHAIN_IAR
 | 
			
		||||
/** @brief  Helper macro to swap 2 handles, which is useful for the Find() idiom. */
 | 
			
		||||
/* note, memory barriers may be required in the following implementation */
 | 
			
		||||
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe)         \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -334,6 +334,16 @@ extern "C" int PREFIX(_write)(FILEHANDLE fh, const unsigned char *buffer, unsign
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
 | 
			
		||||
extern "C" void PREFIX(_exit)(int return_code) {
 | 
			
		||||
    while(1) {}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern "C" void _ttywrch(int ch) {
 | 
			
		||||
    serial_putc(&stdio_uart, ch);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(__ICCARM__)
 | 
			
		||||
extern "C" size_t    __read (int        fh, unsigned char *buffer, size_t       length) {
 | 
			
		||||
#else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -234,7 +234,7 @@ osMutexAttr_t             singleton_mutex_attr;
 | 
			
		|||
#if !defined(HEAP_START)
 | 
			
		||||
    #if defined(__ICCARM__)
 | 
			
		||||
        #error "Heap should already be defined for IAR"
 | 
			
		||||
    #elif defined(__CC_ARM)
 | 
			
		||||
    #elif defined(__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
 | 
			
		||||
        extern uint32_t          Image$$RW_IRAM1$$ZI$$Limit[];
 | 
			
		||||
        #define HEAP_START      ((unsigned char*)Image$$RW_IRAM1$$ZI$$Limit)
 | 
			
		||||
        #define HEAP_SIZE       ((uint32_t)((uint32_t)INITIAL_SP - (uint32_t)HEAP_START))
 | 
			
		||||
| 
						 | 
				
			
			@ -330,7 +330,7 @@ void mbed_start_main(void)
 | 
			
		|||
 | 
			
		||||
/******************** Toolchain specific code ********************/
 | 
			
		||||
 | 
			
		||||
#if defined (__CC_ARM)
 | 
			
		||||
#if defined (__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
 | 
			
		||||
 | 
			
		||||
/* Common for both ARMC and MICROLIB */
 | 
			
		||||
int $Super$$main(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -402,7 +402,12 @@ void pre_main (void)
 | 
			
		|||
   With the RTOS there is not only one stack above the heap, there are multiple
 | 
			
		||||
   stacks and some of them are underneath the heap pointer.
 | 
			
		||||
*/
 | 
			
		||||
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
 | 
			
		||||
__asm(".global __use_two_region_memory\n\t");
 | 
			
		||||
__asm(".global __use_no_semihosting\n\t");
 | 
			
		||||
#else
 | 
			
		||||
#pragma import(__use_two_region_memory)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Called by the C library */
 | 
			
		||||
void __rt_entry (void) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,7 +41,7 @@
 | 
			
		|||
 | 
			
		||||
#define OS_DYNAMIC_MEM_SIZE         0
 | 
			
		||||
 | 
			
		||||
#if defined(__CC_ARM)
 | 
			
		||||
#if defined (__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
 | 
			
		||||
/* ARM toolchain uses up to 8 static mutexes, any further mutexes will be allocated on the heap. */
 | 
			
		||||
#define OS_MUTEX_OBJ_MEM            1
 | 
			
		||||
#define OS_MUTEX_NUM                8
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -595,7 +595,9 @@ void *__user_perthread_libspace (void) {
 | 
			
		|||
typedef void *mutex;
 | 
			
		||||
 | 
			
		||||
// Initialize mutex
 | 
			
		||||
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
 | 
			
		||||
__USED
 | 
			
		||||
#endif
 | 
			
		||||
int _mutex_initialize(mutex *m);
 | 
			
		||||
__WEAK int _mutex_initialize(mutex *m) {
 | 
			
		||||
  *m = osMutexNew(NULL);
 | 
			
		||||
| 
						 | 
				
			
			@ -607,7 +609,9 @@ __WEAK int _mutex_initialize(mutex *m) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// Acquire mutex
 | 
			
		||||
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
 | 
			
		||||
__USED
 | 
			
		||||
#endif
 | 
			
		||||
void _mutex_acquire(mutex *m);
 | 
			
		||||
__WEAK void _mutex_acquire(mutex *m) {
 | 
			
		||||
  if (os_kernel_is_active()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -616,7 +620,9 @@ __WEAK void _mutex_acquire(mutex *m) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// Release mutex
 | 
			
		||||
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
 | 
			
		||||
__USED
 | 
			
		||||
#endif
 | 
			
		||||
void _mutex_release(mutex *m);
 | 
			
		||||
__WEAK void _mutex_release(mutex *m) {
 | 
			
		||||
  if (os_kernel_is_active()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -625,7 +631,9 @@ __WEAK void _mutex_release(mutex *m) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// Free mutex
 | 
			
		||||
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
 | 
			
		||||
__USED
 | 
			
		||||
#endif
 | 
			
		||||
void _mutex_free(mutex *m);
 | 
			
		||||
__WEAK void _mutex_free(mutex *m) {
 | 
			
		||||
  osMutexDelete(*m);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue