4 years, 9 months ago.

Compiler Bug?

I have a struct of 4 integers like this:


#include "mbed.h"

struct ints {
    int i0, i1, i2, i3;    

struct ints i[0xf4]; //0xf3 works, 0xf4 doesn't

int main(int argc, char **argv) {
    i[0].i0 = 1; //if i don't initialize some data, it also compiles fine
    return 0;

Now the sice of the struct is 16 bytes, since one integer has 32 bits.

When I create an array of this struct, I can't have it larger than about 0xa0 items, which is 2kByte of memory (Otherwise the compiler tells me, that I am out of memory). The Project overview tells me, that I have about 6.5kByte of memory still available, when I remove that array.

I'm compiling for the LPC11u24.

The Compiler error code it gives: L6407E

My question is: Is this a bug in the compiler (I doubt it). Or is there some other hindrance like bank switching, which the compiler doesn't implement?

What's the target? A simple app to reproduce the problem - so we cn just import and see ?

posted by Martin Kojtal 08 Aug 2016

1 Answer

4 years, 8 months ago.


I have tried to replicate your issue, however, i have successfully built and compiled using the LPC11u24 using 3.8kb/8kb, have you tried recreating the program? Have you tried placing data in 'const' in flash rather than RAM? Can you upload your exact problem and code to test.



This is the exact problem code. I first encountered this in a large project and tested it with this code in a completely new project. This is also why the values have changed from A0H to F3H.

posted by Manuel Federanko 10 Aug 2016

I just tried it with a third project and realized, that my first test program and the original project both used a old mbed library. Updating it resolved the issue.

posted by Manuel Federanko 10 Aug 2016

Hi Manuel, I'm wondering how you can update the old mbed library? I'm experiencing similar issue as you have. Thank you!

posted by Zach Wang 19 Aug 2016