STM32: Add support for the IAR compiler

This commit is contained in:
Aleksandr Vyhovanec
2016-04-02 06:58:55 -06:00
committed by Gregory Nutt
parent 2234d7d8e5
commit 29ab0fb991
4 changed files with 727 additions and 9 deletions
@@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* arch/arm/src/stm32/stm32_vectors.S * arch/arm/src/stm32/gnu/stm32_vectors.S
* *
* Copyright (C) 2009-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2009-2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
File diff suppressed because it is too large Load Diff
+13 -3
View File
@@ -83,11 +83,17 @@
volatile uint32_t *g_current_regs[1]; volatile uint32_t *g_current_regs[1];
/* This is the address of the exception vector table (determined by the /* This is the address of the exception vector table (determined by the
* linker script). * linker script).
*/ */
#if defined(__ICCARM__)
/* _vectors replaced on __vector_table for IAR C-SPY Simulator */
extern uint32_t __vector_table[];
#else
extern uint32_t _vectors[]; extern uint32_t _vectors[];
#endif
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@@ -329,7 +335,11 @@ void up_irqinitialize(void)
* will need to set the NVIC vector location to this alternative location. * will need to set the NVIC vector location to this alternative location.
*/ */
#if defined(__ICCARM__)
putreg32((uint32_t)__vector_table, NVIC_VECTAB);
#else
putreg32((uint32_t)_vectors, NVIC_VECTAB); putreg32((uint32_t)_vectors, NVIC_VECTAB);
#endif
#ifdef CONFIG_ARCH_RAMVECTORS #ifdef CONFIG_ARCH_RAMVECTORS
/* If CONFIG_ARCH_RAMVECTORS is defined, then we are using a RAM-based /* If CONFIG_ARCH_RAMVECTORS is defined, then we are using a RAM-based
+21 -4
View File
@@ -1,8 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/stm32/stm32_start.c * arch/arm/src/stm32/stm32_start.c
* arch/arm/src/chip/stm32_start.c
* *
* Copyright (C) 2009, 2011-2015 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2011-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -58,6 +57,24 @@
# include "nvic.h" # include "nvic.h"
#endif #endif
/****************************************************************************
* Pre-processor definitions
****************************************************************************/
#if defined(__ICCARM__)
# define _START_BSS __sfb(".bss")
# define _END_BSS __sfe(".bss")
# define _DATA_INIT __sfb(".data_init")
# define _START_DATA __sfb(".data")
# define _END_DATA __sfe(".data")
#else
# define _START_BSS &_sbss
# define _END_BSS &_ebss
# define _DATA_INIT &_eronly
# define _START_DATA &_sdata
# define _END_DATA &_edata
#endif
/**************************************************************************** /****************************************************************************
* Private Function prototypes * Private Function prototypes
****************************************************************************/ ****************************************************************************/
@@ -263,7 +280,7 @@ void __start(void)
* certain that there are no issues with the state of global variables. * certain that there are no issues with the state of global variables.
*/ */
for (dest = &_sbss; dest < &_ebss; ) for (dest = _START_BSS; dest < __END_BSS; )
{ {
*dest++ = 0; *dest++ = 0;
} }
@@ -276,7 +293,7 @@ void __start(void)
* end of all of the other read-only data (.text, .rodata) at _eronly. * end of all of the other read-only data (.text, .rodata) at _eronly.
*/ */
for (src = &_eronly, dest = &_sdata; dest < &_edata; ) for (src = _DATA_INIT, dest = _START_DATA; dest < _END_DATA; )
{ {
*dest++ = *src++; *dest++ = *src++;
} }