This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Beaglebone Black with GCC hits exception

I am using CCS v5.5 and a Beaglebone Black (rev A5C). I have successfully gotten code working bare metal using the TI compiler (5.1.1). A coworker pointed out that CCS also includes GCC 4.7.3. I am trying to get code to work with GCC now.

I create a new CCS Project with:
Project name: GccBbb
Output type: Executable
Use default location checked
Device Family: ARM
Device Variant: BeagleBone_Black [Cortex A]
Connection: Texas Instruments XDS100v2 USB Emulator
Device endianness: little
Compiler version: GNU v4.7.3
Linker command file:
Runtime support library:
Project template: Empty Project (with main.c)

This creates a single source file with the function main that returns 0. I compile the project then debug it selecting to only load the program on the CortxA8 processor.

At some point before hitting main, the program starts executing what appears to be the invalid instruction handler.

The instruction that appears to send it to la la land appears to be:
80000168: E5033004 STR R3, [R3, #--4]

When it is executed, R3 holds the value 0x80000000, which is the start of DDR0.

This is confusing, since I don't see that memory location mapping to anything, though maybe it maps to something in libc.

Could anyone suggest what I am doing wrong?

  • It seems that _start (crt0.a) sets up all of the different mode stacks. In so doing it attempted to write one word past the bottom of RAM. By defining STACKSIZE in the .lds file to 0x20000 I was able to make the stack segment sufficiently large that this no longer happens.