0
votes

I am working on ARM cortex A7 based embedded system that runs Linux. I am looking for c/c++ compiler (as GCC is around 100 mb) which is compact in size and reliable. I have shortlisted some as SDCC, TCC, OTCC, Digital Mars, NWCC, LCC, Small C, portable C compiler.

I want to know if compilers are dependent on operating system or hardware and how should I proceed to start strip down the list. I am not an expert and I am learning about Linux systems and embedded environment. If you think I am asking wrong question or going in wrong direction, Kindly let me know.

Thanks you

Note

I already have cross compiler on my linux (laptop) system. I compile program to be loaded using this only. But the embedded system is supposed to be able to load with a particular language designed by us, I am hoping to convert that language in to equivalent C code and run it. I tried writing my own interpreter in c that accepts the code in other language and parse it and executes but it's little slow, I tried same instructions in (directly written in) C with satisfactory results.

Edit: I ended up using g++ on my system to compile code, as main function of system was to use generated code.

1
Why do you need a small compiler? Are you planning on running it on the embedded target itself? Why does your embedded system need to compile stuff? - Ross
The embedded system is supposed to be able to load with a particular language designed by us, I am hoping to convert that language in to equivalent C code. I tried writing my own interpreter but it's little slow, I tried same instructions in C with satisfactory results. That's why. - Ruturaj
Maybe you would be better off to use a lightweight scripting language specifically designed for embedding, like LUA? - maxy
I tried LUA, results were satisfactory, but I am planning to consider and compare all possible options before making the decision. - Ruturaj

1 Answers

2
votes

Generally, when dealing with embedded systems you are better off cross-compiling and sending the binaries than compiling directly on the device. Even though it may consume you some time setting up the toolchain on the beginning, it definitely pays you back with build time.

There are several pre-built Linaro GCC which are cross-compilers having (generally) x86 linux as host and arm linux as target platforms. This way, you should not worry about compiler size.