AnsweredAssumed Answered

Hard fault with stm32 std peripheral library

Question asked by paulm on Nov 13, 2014
Latest reply on Nov 16, 2014 by Tamas Novak

This is a pretty noob question but I'm going to ask it anyway, because it seems like I'm missing something. 

I've just set up new STM32F1xx and STM32L1xx projects based on the GNU ARM plugin for eclipse.  I'm wanting to use the standard peripheral libraries and CMSIS goodness so that I have nice clean portable HAL interfaces going forward, that others are familiar with.

Going through the code of the RCC peripheral (stm32l1xx_rcc.c/stm32l1xx_rcc.h), I see there is reference to RCC (RCC_TypeDef *) that is defined as a macro in stm32l1xx.h (#define RCC   ((RCC_TypeDef *) RCC_BASE)).  There doesn't seem to be any variable or pointer reference defined in the library so that it can be accessed from SRAM.  This is obviously easy to add in and is necessary if you don't want a hard fault when you call RCC->CR in your main loop, however I can't help feeling that there is an easier way around this.  Perhaps there's an include I've missed, a compiler switch or some macro  I should be using.  Having searched through the peripherals library source code, I haven't found anything indicating this.  Eventually I found what I was expecting to see, however this was in the debug project example (stm32l1xx_ip_dbg.c) and not the std libs. 

Is there an easier way to do this, I'm sure the std libs would not be incomplete as it appears?