[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] uclinux memory exhausted, unable to allocate RAM



victor-sv_yeo@xxxxxxxxxxx wrote:

The pain associated with (3) is why we've gone to the effort of creating a standalone toolchain, and why snapgear created the ucfront tool.

I guess the standalone toolchain here refers to microblaze-uclinux-gcc. However, I have a mixture of .c and .cpp files, and I have to use microblaze-uclinux-g++ for linking.

Is there a way to invoke compiler and linking in one single phase for c and cpp source files?

The easiest way is to use the compiler front-end as the linker. So, you can do something like this:

$ microblaze-uclinux-gcc -c foo.c
$ microblaze-uclinux-g++ -c foobar.cxx
$ microblaze-uclinux-g++ -o foo foo.o foobar.o
$ microblaze-uclinux-flthdr foo
foo
    Magic:        bFLT
    Rev:          4
    Build Date:   Fri Jun 29 09:30:52 2007
    Entry:        0x44
    Data Start:   0x5bc20
    Data End:     0x61450
    BSS End:      0x66190
    Stack Size:   0x1000
    Reloc Start:  0x61450
    Reloc Count:  0x106c
    Flags:        0x1 ( Load-to-Ram )


This produces foo - a flat binary, ready to run on the microblaze, and foo.gdb, the ELF object used for debugging.

Alternatively, you could also try

$ microblaze-uclinux-g++ -o foo foo.c foobar.cxx
$ microblaze-uclinux-flthdr foo
foo
    Magic:        bFLT
    Rev:          4
    Build Date:   Fri Jun 29 09:31:23 2007
    Entry:        0x44
    Data Start:   0x5bc20
    Data End:     0x61450
    BSS End:      0x66190
    Stack Size:   0x1000
    Reloc Start:  0x61450
    Reloc Count:  0x106c
    Flags:        0x1 ( Load-to-Ram )


Here we are compiling the .c file with the C++ compiler. In many cases this works just fine, since C++ is largely a superset of C. However, symbols called 'new', and other gotchas will trip you up here.

Regards,

John
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/