cancel
Showing results for 
Search instead for 
Did you mean: 

startup.c file for stm32f2xx

acihana
Associate II
Posted on December 03, 2011 at 13:55

Hi,

I'm using STM32f205RB with codesourcery g++ compiller. I need startup file written in c language which includes vector table and interrupt handlers. In example projects there are only startup.s files.
10 REPLIES 10
Andrew Neil
Evangelist III
Posted on December 03, 2011 at 19:38

''I need startup file written in c language which includes vector table and interrupt handlers''

 

Why?

''In example projects there are only startup.s files''

 

So why not use them??

Posted on December 03, 2011 at 22:25

You'd think if it were remotely appropriate for it to be in C that it would already exist in that in form?

The linker works with object files, assemble the S file, and link it in.

Learn to use the tools, and the requirements of the ARM Cortex-M3 in regard to it's vectors and there placement. Understand the startup requirements of G++, and if the C runtime startup requirements are the different, or the same.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
acihana
Associate II
Posted on December 05, 2011 at 08:43

Thanks for replies,

I wrote it myself. The file's attached if needed.

________________

Attachments :

startup.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtWm&d=%2Fa%2F0X0000000aRI%2F7cYyTErb.U8uoSDTsVQBLZ2FV8UB5SBEpMWqlGk36as&asPdf=false
infoinfo989
Associate III
Posted on December 06, 2011 at 00:26

That's pretty interesting. I use the standard .s file like everyone else, but I think what you've done is interesting. One question: is it for the F1x or F2x processors? This discussion is about the 2xx however your attached file says:

// startup.c - Boot code for STM32F10x Arm Cortex-M3 microcontrollers // Copyright (c) 2007-2008 Bilkon Bilgisayar Kontrollu Cihazlar Ltd.Sti

Which processor did you use this file for?

Thanks.

domen23
Associate II
Posted on December 09, 2011 at 13:31

Interrupt handler names give out it's stm32f2xx. Other than those, all arm-cortex-m3 have the same startup code anyways.

stforum.tormod9
Associate II
Posted on December 10, 2011 at 20:43

I have also been using C files instead of assembly, at least for the vector table, for STM32F1xx. It actually worked better using C in my case.

https://gitorious.org/dsonano/dso-firmware/blobs/master/DS0201_LIB/source/stm32f10x_vector.c

It seems like ST used C in IAR examples, but assembly in GCC examples. The above file has some modifications so that it builds both with IAR and GCC.

domen23
Associate II
Posted on December 12, 2011 at 07:30

> From: Tormod

> It actually worked better using C in my case.

What do you mean by this?
acihana
Associate II
Posted on December 14, 2011 at 17:13

Hi Frank,

I copied that explanation header from my another file, so I made a mistake it must be like that;

// startup.c - Boot code for STM32F2xx Arm Cortex-M3 microcontrollers// Copyright (c) 2011-2012 Bilkon Bilgisayar Kontrollu Cihazlar Ltd.Sti

acihana
Associate II
Posted on December 14, 2011 at 17:20

Yes, largely the same except for interrupt handler orders.