修复mico-sdk错误

This commit is contained in:
nhkefus
2025-03-11 15:54:45 +08:00
parent 3422912129
commit 2ccb892a1c
2152 changed files with 664341 additions and 702636 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,52 +1,52 @@
/**
******************************************************************************
* @file crt0_EWARM.h
* @author William Xu
* @version V1.0.0
* @date 16-Sep-2014
* @brief __low_level_init called by IAR before main.
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#include "platform.h"
#include "crt0.h"
extern void* app_hdr_start_addr_loc;
#define SCB_VTOR_ADDRESS ( ( volatile unsigned long* ) 0xE000ED08 )
#define APP_HDR_START_ADDR ((unsigned char*)&app_hdr_start_addr_loc)
int __low_level_init( void );
/* This is the code that gets called on processor reset. To initialize the */
/* device. */
#pragma section=".intvec"
#pragma section=".intvec_RAM"
int __low_level_init( void )
{
extern void init_clocks(void);
extern void init_memory(void);
/* IAR allows init functions in __low_level_init(), but it is run before global
* variables have been initialised, so the following init still needs to be done
* When using GCC, this is done in crt0_GCC.c
*/
#ifdef BOOTLOADER
/* Set the Vector Table base location at 0x20000000 */
//*SCB_VTOR_ADDRESS = 0x20000000;
*SCB_VTOR_ADDRESS = (unsigned long )__section_begin(".intvec_RAM");
#else
/* Setup the interrupt vectors address */
*SCB_VTOR_ADDRESS = (unsigned long )__section_begin(".intvec");
init_clocks();
init_memory();
#endif
return 1; /* return 1 to force memory init */
}
/**
******************************************************************************
* @file crt0_EWARM.h
* @author William Xu
* @version V1.0.0
* @date 16-Sep-2014
* @brief __low_level_init called by IAR before main.
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#include "platform.h"
#include "crt0.h"
extern void* app_hdr_start_addr_loc;
#define SCB_VTOR_ADDRESS ( ( volatile unsigned long* ) 0xE000ED08 )
#define APP_HDR_START_ADDR ((unsigned char*)&app_hdr_start_addr_loc)
int __low_level_init( void );
/* This is the code that gets called on processor reset. To initialize the */
/* device. */
#pragma section=".intvec"
#pragma section=".intvec_RAM"
int __low_level_init( void )
{
extern void init_clocks(void);
extern void init_memory(void);
/* IAR allows init functions in __low_level_init(), but it is run before global
* variables have been initialised, so the following init still needs to be done
* When using GCC, this is done in crt0_GCC.c
*/
#ifdef BOOTLOADER
/* Set the Vector Table base location at 0x20000000 */
//*SCB_VTOR_ADDRESS = 0x20000000;
*SCB_VTOR_ADDRESS = (unsigned long )__section_begin(".intvec_RAM");
#else
/* Setup the interrupt vectors address */
*SCB_VTOR_ADDRESS = (unsigned long )__section_begin(".intvec");
init_clocks();
init_memory();
#endif
return 1; /* return 1 to force memory init */
}

View File

@@ -1,46 +1,46 @@
/**
******************************************************************************
* @file crt0_RVMDK.h
* @author William Xu
* @version V1.0.0
* @date 16-Sep-2014
* @brief __low_level_init called by IAR before main.
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#include "platform.h"
#include "crt0.h"
extern void* app_hdr_start_addr_loc;
#define SCB_VTOR_ADDRESS ( ( volatile unsigned long* ) 0xE000ED08 )
#define APP_HDR_START_ADDR ((unsigned char*)&app_hdr_start_addr_loc)
extern unsigned long Image$$ER_IROM1$$Base;
int __low_level_init( void );
/* This is the code that gets called on processor reset. To initialize the */
/* device. */
int __low_level_init( void )
{
extern void init_clocks(void);
extern void init_memory(void);
/* IAR allows init functions in __low_level_init(), but it is run before global
* variables have been initialised, so the following init still needs to be done
* When using GCC, this is done in crt0_GCC.c
*/
/* Setup the interrupt vectors address */
*SCB_VTOR_ADDRESS = (unsigned long)&Image$$ER_IROM1$$Base;
init_clocks();
init_memory();
return 1; /* return 1 to force memory init */
}
/**
******************************************************************************
* @file crt0_RVMDK.h
* @author William Xu
* @version V1.0.0
* @date 16-Sep-2014
* @brief __low_level_init called by IAR before main.
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#include "platform.h"
#include "crt0.h"
extern void* app_hdr_start_addr_loc;
#define SCB_VTOR_ADDRESS ( ( volatile unsigned long* ) 0xE000ED08 )
#define APP_HDR_START_ADDR ((unsigned char*)&app_hdr_start_addr_loc)
extern unsigned long Image$$ER_IROM1$$Base;
int __low_level_init( void );
/* This is the code that gets called on processor reset. To initialize the */
/* device. */
int __low_level_init( void )
{
extern void init_clocks(void);
extern void init_memory(void);
/* IAR allows init functions in __low_level_init(), but it is run before global
* variables have been initialised, so the following init still needs to be done
* When using GCC, this is done in crt0_GCC.c
*/
/* Setup the interrupt vectors address */
*SCB_VTOR_ADDRESS = (unsigned long)&Image$$ER_IROM1$$Base;
init_clocks();
init_memory();
return 1; /* return 1 to force memory init */
}

View File

@@ -1,117 +1,117 @@
/**
******************************************************************************
* @file hardfault.c
* @author William Xu
* @version V1.0.0
* @date 05-May-2014
* @brief This file provide debug information in hardfault.
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#include "stdio.h"
#include "mico.h"
#include "platform_config.h"
extern OSStatus stdio_hardfault( char* data, uint32_t size );
#if defined ( __CC_ARM )
#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
/* IAR iccarm specific functions */
#define __ASM __asm /*!< asm keyword for IAR Compiler */
#define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
#include <cmsis_iar.h>
#elif defined ( __GNUC__ )
#endif
void hard_fault_handler_c (unsigned int * hardfault_args)
{
unsigned int stacked_r0;
unsigned int stacked_r1;
unsigned int stacked_r2;
unsigned int stacked_r3;
unsigned int stacked_r12;
unsigned int stacked_lr;
unsigned int stacked_pc;
unsigned int stacked_psr;
char logString[50];
stacked_r0 = ((unsigned long) hardfault_args[0]);
stacked_r1 = ((unsigned long) hardfault_args[1]);
stacked_r2 = ((unsigned long) hardfault_args[2]);
stacked_r3 = ((unsigned long) hardfault_args[3]);
stacked_r12 = ((unsigned long) hardfault_args[4]);
stacked_lr = ((unsigned long) hardfault_args[5]);
stacked_pc = ((unsigned long) hardfault_args[6]);
stacked_psr = ((unsigned long) hardfault_args[7]);
sprintf (logString,"\n>>>>>>>>>>>>>>[");
stdio_hardfault( logString, strlen(logString)+1 );
switch(__get_IPSR())
{
case 3:
sprintf (logString, "Hard Fault");
stdio_hardfault( logString, strlen(logString)+1 );
break;
case 4:
sprintf (logString, "Memory Manage");
stdio_hardfault( logString, strlen(logString)+1 );
break;
case 5:
sprintf (logString, "Bus Fault");
stdio_hardfault( logString, strlen(logString)+1 );
break;
case 6:
sprintf (logString, "Usage Fault");
stdio_hardfault( logString, strlen(logString)+1 );
break;
default:
sprintf (logString, "Unknown Fault %ld", __get_IPSR());
stdio_hardfault( logString, strlen(logString)+1 );
break;
}
sprintf (logString, ",corrupt,dump registers]>>>>>>>>>>>>>>>>>>\n\r");
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R0 = 0x%08x\r\n", stacked_r0);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R1 = 0x%08x\r\n", stacked_r1);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R2 = 0x%08x\r\n", stacked_r2);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R3 = 0x%08x\r\n", stacked_r3);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R12 = 0x%08x\r\n", stacked_r12);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "LR [R14] = 0x%08x subroutine call return address\r\n", stacked_lr);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "PC [R15] = 0x%08X program counter\r\n", stacked_pc);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "PSR = 0x%08X\r\n", stacked_psr);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "BFAR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED38))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "CFSR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED28))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "HFSR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED2C))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "DFSR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED30))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "AFSR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED3C))));
stdio_hardfault( logString, strlen(logString)+1 );
while (1);
}
/**
******************************************************************************
* @file hardfault.c
* @author William Xu
* @version V1.0.0
* @date 05-May-2014
* @brief This file provide debug information in hardfault.
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#include "stdio.h"
#include "mico.h"
#include "platform_config.h"
extern OSStatus stdio_hardfault( char* data, uint32_t size );
#if defined ( __CC_ARM )
#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
/* IAR iccarm specific functions */
#define __ASM __asm /*!< asm keyword for IAR Compiler */
#define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
#include <cmsis_iar.h>
#elif defined ( __GNUC__ )
#endif
void hard_fault_handler_c (unsigned int * hardfault_args)
{
unsigned int stacked_r0;
unsigned int stacked_r1;
unsigned int stacked_r2;
unsigned int stacked_r3;
unsigned int stacked_r12;
unsigned int stacked_lr;
unsigned int stacked_pc;
unsigned int stacked_psr;
char logString[50];
stacked_r0 = ((unsigned long) hardfault_args[0]);
stacked_r1 = ((unsigned long) hardfault_args[1]);
stacked_r2 = ((unsigned long) hardfault_args[2]);
stacked_r3 = ((unsigned long) hardfault_args[3]);
stacked_r12 = ((unsigned long) hardfault_args[4]);
stacked_lr = ((unsigned long) hardfault_args[5]);
stacked_pc = ((unsigned long) hardfault_args[6]);
stacked_psr = ((unsigned long) hardfault_args[7]);
sprintf (logString,"\n>>>>>>>>>>>>>>[");
stdio_hardfault( logString, strlen(logString)+1 );
switch(__get_IPSR())
{
case 3:
sprintf (logString, "Hard Fault");
stdio_hardfault( logString, strlen(logString)+1 );
break;
case 4:
sprintf (logString, "Memory Manage");
stdio_hardfault( logString, strlen(logString)+1 );
break;
case 5:
sprintf (logString, "Bus Fault");
stdio_hardfault( logString, strlen(logString)+1 );
break;
case 6:
sprintf (logString, "Usage Fault");
stdio_hardfault( logString, strlen(logString)+1 );
break;
default:
sprintf (logString, "Unknown Fault %ld", __get_IPSR());
stdio_hardfault( logString, strlen(logString)+1 );
break;
}
sprintf (logString, ",corrupt,dump registers]>>>>>>>>>>>>>>>>>>\n\r");
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R0 = 0x%08x\r\n", stacked_r0);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R1 = 0x%08x\r\n", stacked_r1);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R2 = 0x%08x\r\n", stacked_r2);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R3 = 0x%08x\r\n", stacked_r3);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "R12 = 0x%08x\r\n", stacked_r12);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "LR [R14] = 0x%08x subroutine call return address\r\n", stacked_lr);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "PC [R15] = 0x%08X program counter\r\n", stacked_pc);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "PSR = 0x%08X\r\n", stacked_psr);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "BFAR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED38))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "CFSR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED28))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "HFSR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED2C))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "DFSR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED30))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "AFSR = 0x%08lx\r\n", (*((volatile unsigned long *)(0xE000ED3C))));
stdio_hardfault( logString, strlen(logString)+1 );
while (1);
}

0
mico-os/platform/Cortex-M4F/hardfault_handler.c Executable file → Normal file
View File

View File

@@ -1,88 +1,88 @@
/**
******************************************************************************
* @file platform_assert.h
* @author William Xu
* @version V1.0.0
* @date 05-May-2014
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#pragma once
/******************************************************
* Macros
******************************************************/
/******************************************************
* Constants
******************************************************/
#ifdef __GNUC__
#define MICO_ASSERTION_FAIL_ACTION() __asm__("bkpt")
#elif defined ( __IAR_SYSTEMS_ICC__ )
#define MICO_ASSERTION_FAIL_ACTION() __asm("bkpt 0")
#elif defined ( __CC_ARM )
#define MICO_ASSERTION_FAIL_ACTION() __asm("bkpt 0")
#endif
#if defined ( __GNUC__ )
#if defined ( __clang__ )
static inline /*@noreturn@*/void MICO_TRIGGER_BREAKPOINT( void ) __attribute__((analyzer_noreturn))
{
__asm__("bkpt");
}
#else
#define MICO_TRIGGER_BREAKPOINT( ) do { __asm__("bkpt"); } while (0)
#endif /* #if defined ( __clang__ ) */
#ifdef NO_VECTORS
#define MICO_DISABLE_INTERRUPTS() do { __asm__("" : : : "memory"); } while (0)
#define MICO_ENABLE_INTERRUPTS() do { __asm__("" : : : "memory"); } while (0)
#else
#define MICO_DISABLE_INTERRUPTS() do { __asm__("CPSID i" : : : "memory"); } while (0)
#define MICO_ENABLE_INTERRUPTS() do { __asm__("CPSIE i" : : : "memory"); } while (0)
#endif
#define CSPR_INTERRUPTS_DISABLED (0x80)
#elif defined ( __IAR_SYSTEMS_ICC__ )
#define MICO_TRIGGER_BREAKPOINT() do { __asm("bkpt 0"); } while (0)
#define MICO_DISABLE_INTERRUPTS() do { __asm("CPSID i"); } while (0)
#define MICO_ENABLE_INTERRUPTS() do { __asm("CPSIE i"); } while (0)
#endif
/******************************************************
* Enumerations
******************************************************/
/******************************************************
* Type Definitions
******************************************************/
/******************************************************
* Structures
******************************************************/
/******************************************************
* Global Variables
******************************************************/
/******************************************************
* Function Declarations
******************************************************/
/**
******************************************************************************
* @file platform_assert.h
* @author William Xu
* @version V1.0.0
* @date 05-May-2014
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#pragma once
/******************************************************
* Macros
******************************************************/
/******************************************************
* Constants
******************************************************/
#ifdef __GNUC__
#define MICO_ASSERTION_FAIL_ACTION() __asm__("bkpt")
#elif defined ( __IAR_SYSTEMS_ICC__ )
#define MICO_ASSERTION_FAIL_ACTION() __asm("bkpt 0")
#elif defined ( __CC_ARM )
#define MICO_ASSERTION_FAIL_ACTION() __asm("bkpt 0")
#endif
#if defined ( __GNUC__ )
#if defined ( __clang__ )
static inline /*@noreturn@*/void MICO_TRIGGER_BREAKPOINT( void ) __attribute__((analyzer_noreturn))
{
__asm__("bkpt");
}
#else
#define MICO_TRIGGER_BREAKPOINT( ) do { __asm__("bkpt"); } while (0)
#endif /* #if defined ( __clang__ ) */
#ifdef NO_VECTORS
#define MICO_DISABLE_INTERRUPTS() do { __asm__("" : : : "memory"); } while (0)
#define MICO_ENABLE_INTERRUPTS() do { __asm__("" : : : "memory"); } while (0)
#else
#define MICO_DISABLE_INTERRUPTS() do { __asm__("CPSID i" : : : "memory"); } while (0)
#define MICO_ENABLE_INTERRUPTS() do { __asm__("CPSIE i" : : : "memory"); } while (0)
#endif
#define CSPR_INTERRUPTS_DISABLED (0x80)
#elif defined ( __IAR_SYSTEMS_ICC__ )
#define MICO_TRIGGER_BREAKPOINT() do { __asm("bkpt 0"); } while (0)
#define MICO_DISABLE_INTERRUPTS() do { __asm("CPSID i"); } while (0)
#define MICO_ENABLE_INTERRUPTS() do { __asm("CPSIE i"); } while (0)
#endif
/******************************************************
* Enumerations
******************************************************/
/******************************************************
* Type Definitions
******************************************************/
/******************************************************
* Structures
******************************************************/
/******************************************************
* Global Variables
******************************************************/
/******************************************************
* Function Declarations
******************************************************/

0
mico-os/platform/Cortex-M4F/platform_core.c Executable file → Normal file
View File