Added weak symbols for STM32W exception handlers and other minor updates for the HAL.

This commit is contained in:
Salvatore Pitrulli 2011-03-25 09:13:53 +01:00 committed by Salvatore Pitrulli
parent 57163c616d
commit 0a0ad39c9b
8 changed files with 79 additions and 94 deletions

View file

@ -25,37 +25,6 @@ _estack = __Stack_Init + __Stack_Size;
/*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/
PROVIDE ( _Stack_Init = __Stack_Init ) ;
/*
this sends all unreferenced IRQHandlers to a Default_Handler or a reset.
*/
PROVIDE(Default_Handler = 0 );
PROVIDE(NMI_Handler = Default_Handler );
PROVIDE(HardFault_Handler = Default_Handler );
PROVIDE(MemManage_Handler = Default_Handler );
PROVIDE(BusFault_Handler = Default_Handler );
PROVIDE(UsageFault_Handler = Default_Handler );
PROVIDE(SVC_Handler = Default_Handler );
PROVIDE(DebugMonitor_Handler = Default_Handler );
PROVIDE(PendSV_Handler = Default_Handler );
PROVIDE(SysTick_Handler = Default_Handler );
PROVIDE(halTimer1Isr = Default_Handler );
PROVIDE(halTimer2Isr = Default_Handler );
PROVIDE(halManagementIsr = Default_Handler );
PROVIDE(halBaseBandIsr = Default_Handler );
PROVIDE(halSleepTimerIsr = Default_Handler );
PROVIDE(halSc1Isr = Default_Handler );
PROVIDE(halSc2Isr = Default_Handler );
PROVIDE(halSecurityIsr = Default_Handler );
PROVIDE(halStackMacTimerIsr = Default_Handler );
PROVIDE(stmRadioTransmitIsr = Default_Handler );
PROVIDE(stmRadioReceiveIsr = Default_Handler );
PROVIDE(halAdcIsr = Default_Handler );
PROVIDE(halIrqAIsr = Default_Handler );
PROVIDE(halIrqBIsr = Default_Handler );
PROVIDE(halIrqCIsr = Default_Handler );
PROVIDE(halIrqDIsr = Default_Handler );
PROVIDE(halDebugIsr = Default_Handler );
/******************************************************************************/
/* Peripheral memory map */

View file

@ -34,6 +34,8 @@
#ifndef __ADC_H__
#define __ADC_H__
#ifdef CORTEXM3_STM32W108
// A type for the ADC User enumeration.
typedef int8u ADCUser;
enum
@ -287,6 +289,11 @@ boolean halAdcGetClock(void);
boolean halAdcGetRange(void);
#endif
#endif /* CORTEXM3_STM32W108 */
#ifdef CORTEXM3_STM32F103
#include "micro/cortexm3/stm32f103ret/adc.h"
#endif /* CORTEXM3_STM32F103 */
#endif // __ADC_H__
/** @} // END addtogroup

View file

@ -109,6 +109,14 @@ const ButtonResourceType ButtonsMB950A[] = {
}
};
const ButtonResourceType ButtonsMB951A[] = {
{
"S1",
PORTA,
3
},
};
const TempSensorResourceType tempSensorMB851A = {
"STLM20",
PORTB,
@ -143,6 +151,11 @@ const BoardIOType ioMB950A = {
ButtonsMB950A,
};
const BoardIOType ioMB951A = {
LedsMB954A,
ButtonsMB951A,
};
const BoardResourcesType MB851A = {
"MB851 A",
(BOARD_HAS_MEMS | BOARD_HAS_TEMP_SENSOR | BOARD_HAS_FTDI),
@ -214,7 +227,7 @@ const BoardResourcesType MB951A = {
(BOARD_HAS_STM32F),
BUTTONS_MB951A,
LEDS_MB951A,
&ioMB954A,
&ioMB951A,
NULL,
NULL,
NULL,

View file

@ -15,6 +15,9 @@
#include "memmap.h"
#include "flash.h"
#ifdef FLASH_PROGRAMMING_WITH_EMPTY_FIB
#define ST_EMU_TEST
#endif
// A translation table used to convert FibStatus codes to corresponding
// StStatus values
static const StStatus fibToStStatus[] = {

View file

@ -208,8 +208,8 @@ static int8u i2c_MEMS_Init (void)
i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, STATUS_REG, 0x00); //no flag
i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, FF_WU_CFG, 0x00); // all off
i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, DD_CFG, 0x00); // all off
i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG2, (1<<4) | (1<<1) | (1 << 0));
i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, 0xC7);
i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG2, (0<<4) | (0<<1) | (0 << 0));
i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, 0x47);
if (i != 5)
return 0;
@ -228,6 +228,12 @@ static int8u i2c_MEMS_Read (t_mems_data *mems_data)
{
int8u i, i2c_buffer[8];
/* Wait for new set of data to be available */
while (1) {
i = i2c_read_reg (kLIS3L02DQ_SLAVE_ADDR, STATUS_REG, i2c_buffer, 1);
if (i2c_buffer[0] & (1 << 3))
break;
}
i = i2c_read_reg (kLIS3L02DQ_SLAVE_ADDR, OUTX_L, i2c_buffer, 8);
mems_data->outx_h = i2c_buffer[0];

View file

@ -75,7 +75,7 @@
/**
* @brief Define the number of user buttons in the specific board revision
*/
#define BUTTONS_MB951A 0
#define BUTTONS_MB951A 1
/**
* @brief Data structure for led description

View file

@ -24,32 +24,6 @@
#define IAP_BOOTLOADER_MODE_UART 0
/* Includes ----------------------------------------------------------------------*/
#include PLATFORM_HEADER
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMonitor_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void halTimer1Isr(void);
void halTimer2Isr(void);
void halManagementIsr(void);
void halBaseBandIsr(void);
void halSleepTimerIsr(void);
void halSc1Isr(void);
void halSc2Isr(void);
void halSecurityIsr(void);
void halStackMacTimerIsr(void);
void stmRadioTransmitIsr(void);
void stmRadioReceiveIsr(void);
void halAdcIsr(void);
void halIrqAIsr(void);
void halIrqBIsr(void);
void halIrqCIsr(void);
void halIrqDIsr(void);
void halDebugIsr(void);
/* Exported types --------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
@ -61,7 +35,7 @@ extern unsigned long _edata; /* end address for the .data section. defined in l
extern unsigned long _sbss; /* start address for the .bss section. defined in linker script */
extern unsigned long _ebss; /* end address for the .bss section. defined in linker script */
extern void _estack; /* init value for the stack pointer. defined in linker script */
extern unsigned long _estack; /* init value for the stack pointer. defined in linker script */
#include "hal/micro/cortexm3/memmap.h"
VAR_AT_SEGMENT(const HalFixedAddressTableType halFixedAddressTable, __FAT__);
@ -73,6 +47,50 @@ VAR_AT_SEGMENT(const HalFixedAddressTableType halFixedAddressTable, __FAT__);
void Reset_Handler(void) __attribute__((__interrupt__));
extern int main(void);
extern void halInternalSwitchToXtal(void);
/*******************************************************************************
*
* Provide weak aliases for each Exception handler to the Default_Handler.
* As they are weak aliases, any function with the same name will override
* this definition.
*
*******************************************************************************/
/* Weak definitions of handlers point to Default_Handler if not implemented */
void NMI_Handler() __attribute__ ((weak, alias("Default_Handler")));
void HardFault_Handler() __attribute__ ((weak, alias("Default_Handler")));
void MemManage_Handler() __attribute__ ((weak, alias("Default_Handler")));
void BusFault_Handler() __attribute__ ((weak, alias("Default_Handler")));
void UsageFault_Handler() __attribute__ ((weak, alias("Default_Handler")));
void SVC_Handler() __attribute__ ((weak, alias("Default_Handler")));
void DebugMonitor_Handler() __attribute__ ((weak, alias("Default_Handler")));
void PendSV_Handler() __attribute__ ((weak, alias("Default_Handler")));
void SysTick_Handler() __attribute__ ((weak, alias("Default_Handler")));
void halTimer1Isr() __attribute__ ((weak, alias("Default_Handler")));
void halTimer2Isr() __attribute__ ((weak, alias("Default_Handler")));
void halManagementIsr() __attribute__ ((weak, alias("Default_Handler")));
void halBaseBandIsr() __attribute__ ((weak, alias("Default_Handler")));
void halSleepTimerIsr() __attribute__ ((weak, alias("Default_Handler")));
void halSc1Isr() __attribute__ ((weak, alias("Default_Handler")));
void halSc2Isr() __attribute__ ((weak, alias("Default_Handler")));
void halSecurityIsr() __attribute__ ((weak, alias("Default_Handler")));
void halStackMacTimerIsr() __attribute__ ((weak, alias("Default_Handler")));
void stmRadioTransmitIsr() __attribute__ ((weak, alias("Default_Handler")));
void stmRadioReceiveIsr() __attribute__ ((weak, alias("Default_Handler")));
void halAdcIsr() __attribute__ ((weak, alias("Default_Handler")));
void halIrqAIsr() __attribute__ ((weak, alias("Default_Handler")));
void halIrqBIsr() __attribute__ ((weak, alias("Default_Handler")));
void halIrqCIsr() __attribute__ ((weak, alias("Default_Handler")));
void halIrqDIsr() __attribute__ ((weak, alias("Default_Handler")));
void halDebugIsr() __attribute__ ((weak, alias("Default_Handler")));
void __attribute__ ((weak)) Default_Handler()
{
/* Hang here */
while(1)
{
}
}
/******************************************************************************
*
@ -86,7 +104,7 @@ extern void halInternalSwitchToXtal(void);
__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) =
{
&_estack, // The initial stack pointer
(void (*)(void))&_estack, // The initial stack pointer
Reset_Handler, // 1 The reset handler
NMI_Handler, // 2
HardFault_Handler, // 3

View file

@ -26,37 +26,6 @@ _estack = __Stack_Init + __Stack_Size;
PROVIDE ( _Stack_Init = __Stack_Init ) ;
/*
this sends all unreferenced IRQHandlers to reset
*/
PROVIDE(NMI_Handler = 0 );
PROVIDE(HardFault_Handler = 0 );
PROVIDE(MemManage_Handler = 0 );
PROVIDE(BusFault_Handler = 0 );
PROVIDE(UsageFault_Handler = 0 );
PROVIDE(SVC_Handler = 0 );
PROVIDE(DebugMonitor_Handler = 0 );
PROVIDE(PendSV_Handler = 0 );
PROVIDE(SysTick_Handler = 0 );
PROVIDE(halTimer1Isr = 0 );
PROVIDE(halTimer2Isr = 0 );
PROVIDE(halManagementIsr = 0 );
PROVIDE(halBaseBandIsr = 0 );
PROVIDE(halSleepTimerIsr = 0 );
PROVIDE(halSc1Isr = 0 );
PROVIDE(halSc2Isr = 0 );
PROVIDE(halSecurityIsr = 0 );
PROVIDE(halStackMacTimerIsr = 0 );
PROVIDE(stmRadioTransmitIsr = 0 );
PROVIDE(stmRadioReceiveIsr = 0 );
PROVIDE(halAdcIsr = 0 );
PROVIDE(halIrqAIsr = 0 );
PROVIDE(halIrqBIsr = 0 );
PROVIDE(halIrqCIsr = 0 );
PROVIDE(halIrqDIsr = 0 );
PROVIDE(halDebugIsr = 0 );
/******************************************************************************/
/* Peripheral memory map */
/******************************************************************************/