Can semihosting be used with an empty C project?

Asked by deMimsy

I seem to get make errors when building ussing a project that started out as an empty c-project instead of the standard "STM32F4xx C/C++ Project" provided by launchpad, and I am realizing the only difference between the two is that, though I specify building a c project from the menu system in eclipse, the launchpad project is actually using a c++ linker instead of a c linker. Because of dependencies I cannot port my code over to a launchpad project. So I was wondering if the errors I am receiving is because semihosting cannot be used with a C Linker? I followed this guide to add semihosting to my project:

http://mcuoneclipse.com/2014/09/11/semihosting-with-gnu-arm-embedded-launchpad-and-gnu-arm-eclipse-debug-plugins/

(with openOCD)

and this is the make line that I am using:

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mthumb-interwork -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized -Wall -Wextra -Wmissing-declarations -Wconversion -Wpointer-arith -Wpadded -Wshadow -g -T STM32F4.ld -nostartfiles -Xlinker --gc-sections -L"/home/xxxxxxx/Desktop/Development/workspace/c/aib-development/lib/ld" -Wl,-Map,"test.map" -Xlinker --cref --specs=nano.specs -u _printf_float -u _scanf_float --specs=rdimon.specs -o "test.elf" <all the object files >

the only error I am getting is:
librdimon_s.a(rdimon-syscalls.o): In function `_sbrk':
syscalls.c:(.text._sbrk+0x30): undefined reference to `end'
collect2: error: ld returned 1 exit status

Thank you for your time

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Thomas Preud'homme
Solved:
Last query:
Last reply:
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#1

Hi,

Can you try adding a --specs=nosys.specs ? This should solve the problem you are experiencing.

Hope this helps

Best regards,

Thomas

Revision history for this message
deMimsy (nluzuria) said :
#2

Thank you for your suggestion; however, adding "--specs=nosys.specs" did
nothing, I am still unable to compile and receive the same error messages.

On Sat, Dec 20, 2014 at 4:31 PM, Thomas Preud'homme <
<email address hidden>> wrote:

> Your question #259334 on GCC ARM Embedded changed:
> https://answers.launchpad.net/gcc-arm-embedded/+question/259334
>
> Status: Open => Answered
>
> Thomas Preud'homme proposed the following answer:
> Hi,
>
> Can you try adding a --specs=nosys.specs ? This should solve the problem
> you are experiencing.
>
> Hope this helps
>
> Best regards,
>
> Thomas
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/gcc-arm-embedded/+question/259334/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/gcc-arm-embedded/+question/259334
>
> You received this question notification because you asked the question.
>

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#3

Hi,

my apologizes, I misread your message. I thought _sbrk was undefined when it's _end. Can you show us your linker script? Most likely its definition is missing there.

Best regards,

Thomas

Revision history for this message
deMimsy (nluzuria) said :
#4

This is the script file I import for the controller:
http://pastebin.com/agxWK4Gt

Revision history for this message
Best Thomas Preud'homme (thomas-preudhomme) said :
#5

Hi,

I believe you should define end to the same value as _end_bss. It should point to the end of your static data.

Best regards.

Revision history for this message
deMimsy (nluzuria) said :
#6

It works! Awesome! Thank you so much. I have not worked a lot with linker files, but now that you suggested it, the error report makes complete sense.

Revision history for this message
deMimsy (nluzuria) said :
#7

Thanks Thomas Preud'homme, that solved my question.