修复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

View File

@@ -1,50 +1,50 @@
/**
******************************************************************************
* @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"
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;
#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"
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;
#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_IAR.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_IAR.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,118 +1,118 @@
/**
******************************************************************************
* @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.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 %d", __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 = 0x08%x\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] = 0x08%x subroutine call return address\r\n", stacked_lr);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "PC [R15] = 0x08%x program counter\r\n", stacked_pc);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "PSR = 0x08%x\r\n", stacked_psr);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "BFAR = 0x08%x\r\n", (*((volatile unsigned long *)(0xE000ED38))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "CFSR = 0x%08x\r\n", (*((volatile unsigned long *)(0xE000ED28))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "HFSR = 0x08%x\r\n", (*((volatile unsigned long *)(0xE000ED2C))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "DFSR = 0x08%x\r\n", (*((volatile unsigned long *)(0xE000ED30))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "AFSR = 0x08%x\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.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 %d", __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 = 0x08%x\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] = 0x08%x subroutine call return address\r\n", stacked_lr);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "PC [R15] = 0x08%x program counter\r\n", stacked_pc);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "PSR = 0x08%x\r\n", stacked_psr);
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "BFAR = 0x08%x\r\n", (*((volatile unsigned long *)(0xE000ED38))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "CFSR = 0x%08x\r\n", (*((volatile unsigned long *)(0xE000ED28))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "HFSR = 0x08%x\r\n", (*((volatile unsigned long *)(0xE000ED2C))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "DFSR = 0x08%x\r\n", (*((volatile unsigned long *)(0xE000ED30))));
stdio_hardfault( logString, strlen(logString)+1 );
sprintf (logString, "AFSR = 0x08%x\r\n", (*((volatile unsigned long *)(0xE000ED3C))));
stdio_hardfault( logString, strlen(logString)+1 );
while (1);
}

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

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