Keil™, An ARM® Company

Discussion Forum

RTX and STM32 Library used together?

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Andreas Vogt
Posted
8-Jan-2009 15:54 GMT
Toolset
ARM
New! RTX and STM32 Library used together?

Hello
I am currently starting a new project with STMicros STM32 controller-family (STM32F101C8) and I use the Keil RealView MDK-ARM 3.40 Toolchain with the RTX RTOS for firmware development.
Now, because I d'like to profit from the extensive work STMicro has put into it's very good firmware library (i'm using V 2.0.3) i wanted to combine the library and the RTX Kernel. The idea behind it is mainly to reduce developpment time for all the "simple" I/O routines for SPI/USART/GPIO and so on, because thats where i think the STMicro library with it's functions can help me a lot to get to a working result pretty quick. (Why bother with all the registers when someone else already did it for you?)

Well, the problem is now that the RTX and ST's library weren't made to work together, so there is a lot of confusion in the initialization routines because both products are built to function "as is" and to do that they both want to run there own initialization routines on the controller registers.

I already tryed with a "quick-fix" to remove stuff that gets initialized twice, but it turns out that it isn't very easy to keep both the library-package and the RTX happy at the same time. The compiler and later on the linker just didn't want to stop shouting at me with errors... :(

So, before i waste more time, my question is now if maybe someone else already tryed to merge them together and finally succeeded to get all the initializations done in a way that they stop biting eachothers tails off and actually perfectly work together. Would be nice if you could point out what has to be taken care of or even provide some samples of your initialization code.

Or maybe someone has a better solution, like extracting all the useful functions from the ST library and try to implement them in a seperate source that would be easyer to attach to the RTX environment. I actually didn't want to go that road yet, because it seems to be quite some work for all the peripherals i will use in the project, but if there is no other solution, that's probably the only way to go...

Thanks for your input!

Read-Only
Author
Robert McNamara
Posted
8-Jan-2009 19:46 GMT
Toolset
ARM
New! RE: RTX and STM32 Library used together?

Keil makes a version of the ST Firmware library that works with the Keil environment. The only issue may be that it looks like what Keil is using is the 2.0.1 version. If the version is not an issue, you should use what Keil has provided. If version is important, you should be able to tell what Keil did to make the 2.0.1 ST Firmware library work in the Keil environment and do the same for verions 2.0.3.

Read-Only
Author
Andreas Vogt
Posted
9-Jan-2009 10:28 GMT
Toolset
ARM
New! RE: RTX and STM32 Library used together?

Thanks for the hint. I think i probably found the problem now. The new stm32f10x_map.h header i downloaded from ST (v2.0.3) has changed quite a bit. The old version (v2.0.1) i found in the Keil program folder is only about 28KB large, and the new (v2.0.3) one from ST is now around 489KB large and contains a massive amount of new Bit Definitions to probably any register there is to be found in the STM32 core.
Apart from that i could not see any other major changes, but i did not compare every file there is and i guess there are some other changes included in the new release. (Could not find any release-notes that actually point out what they changed in detail from 2.0.1 to 2.0.3)

Anyway, i will try to go back to the Lib-Package v2.0.1 that was provided by Keil with the MDK and try to get that to run together with the RTX for now. If this works i can still try to use the new map-file to get all the handy bit definitions in my project...

I'll report back if i was successful. :)

Read-Only
Author
Andreas Vogt
Posted
9-Jan-2009 13:19 GMT
Toolset
ARM
New! RE: RTX and STM32 Library used together?

Okay, i think it should work now. At least i managed to compile and debug a small test project combining some running tasks from RTX and some GPIO-Functions to set and reset a certain Port-Bit (flashing LED).

There was a problem i ran into during the linking stage of building the project:
SVC_Handler, PendSV_Handler and SysTick_Handler were defined twice, once in the stm32f10x_it.o (interrupt handlers from the ST Library-Package) and the second definition was in hal_cm3.o, witch seems to be a (hidden) part that gets linked for the RTX. At least thats what i could see in the .map file, because there are some other RTX related functions embedded in this hal_cm3.o.
Anyway, after i commented these three ISR references out of the stm32f10x_it.c and stm32f10x_it.h i managed to complile and link the firmware and load it on to my hardware and run it with the on-chip debugger.

I'd say the biggest problem is solved for now. :)

Next Thread | Thread List | Previous Thread Start a Thread | Settings