frame_dummy() in crtstuff.c

Asked by Pozz Pozz

I'm using GNU gcc for ARM architectures in one of my project. More specifically, I'm using Atmel ARM toolchain that is automatically installed with Atmel Studio 6.2 IDE. This toolchain is the GNU toolchain for ARM.

The example projects from Atmel are linked without -nostartfiles and I noticed frame_dummy() function is automatically linked in the final executable and it is really called from __libc_init_array() as one function in .init_array section.

I'm not an expert so I'm not able to understand the goal of frame_dummy() (I tried to read the source code in crtstuff.c, but I didn't understand anything...). So my question is: is frame_dummy() (and other functions in crtstuff.c) needed only in C++ projects? Could I exclude it from linking in purely C projects.

I'm interested in using the -nostartfiles option that doesn't include frame_dummy().

I think it's safe, because crtstuff.c says at the very beginning:

/* Specialized bits of code needed to support construction and
   destruction of file-scope objects in C++ code. */

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Joey Ye (jinyun-ye) said :
#1

The original purpose of frame_dummy is to initialize exception handling frame, java and transaction memory, which is part of standard libgcc procedure.

You should be able to exclude it if skiping startfiles and jumping directly into main. Refer to sample project "minimum". However, by doing so semihosting IO function may not be properly initilized.

Revision history for this message
Pozz Pozz (pozzugno) said :
#2

> The original purpose of frame_dummy is to initialize exception handling frame,
> java and transaction memory, which is part of standard libgcc procedure.

I don't know the exact meaning of any of those things. Are those three things (exception handling frame, java and transaction memory) relevant in ARM Cortex-M0+ processors and purely C projects?

> You should be able to exclude it if skiping startfiles and jumping directly into main. Refer to sample project "minimum".
> However, by doing so semihosting IO function may not be properly initilized.

Is semihosting facility implemented in Cortex-M0+ processors?

Revision history for this message
Joey Ye (jinyun-ye) said :
#3

None of them is required for Cortex-M0+, they are just standard part of GCC starting up code.

Semihosting is implemented in Cortex-M0+. To use it for standard IO, you need to initialize it by jumping to _start

Can you help with this problem?

Provide an answer of your own, or ask Pozz Pozz for more information if necessary.

To post a message you must log in.