lpcware

Hard Fault when calling __main()

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by krowberr on Thu May 26 16:27:52 MST 2016
I am using the Debug Build Configuration. When I attempt to run the code, I get a Hard Fault in c_startup_lpc1768.c when I make the __main() call. I cam make this go away by renaming my new file from filename.c to filename.c.NotUsed.

The code size is smaller without the file as this is the Debug Build Configuration, unused functions to not appear to be optimized out. That the application links with and without the file shows that the code isn't used anywhere.

I am using the Free Edition of LPCXpresso. Is this what happens when I exceed the allowed Debug code size? It looks like I still have plenty of space available. But the code size increse does seem to break it.

I haven't modified the c_startup_lpc1768.c file at all.

Details on the two images

Works:

From the linker:
   text   data    bss    dec    hexfilename
200112   3572  59428 263112  403c8RockmelonC.axf

At the bottom of the Debug Window:
TargetDownload size = 203684, address=0x170, msg=, rate= 811488

Doesn't work:

From the linker:
   text   data    bss    dec    hexfilename
200704   3572  59436 263712  40620RockmelonC.axf

At the bottom of the Debug WindowL
TargetDowload size = 204276, address=0x170, msg=, rate=841072

Display license type
License type: FULL
Debug limit: 256k
Activation code:…

A FULL copy of LPCXpresso (Free Edition) may be used for production.

Outcomes