On 18 July 2012 14:33, salvatore benedetto <salvatore.benedetto at gmail.com> wrote:> but I still haven't figure out how to build for cortex-m3 > > clang -march=armv7-m -mfloat-abi=soft <something missing?> testReference.cpp -c-march should have done the trick. You can also try -mcpu=cortex-m3, or try -ccc-host-triple armv7m-none-gnueabi (or -eabi), and possibly -ccc-gcc-name code sourcery's gcc, or possibly --sysroot=code sourcery/libc -- cheers, --renato http://systemcall.org/
salvatore benedetto
2012-Jul-18 13:57 UTC
[LLVMdev] Setting up a cross-compiler for cortex-m3
On Wed, Jul 18, 2012 at 3:52 PM, Renato Golin <rengolin at systemcall.org> wrote:> On 18 July 2012 14:33, salvatore benedetto > <salvatore.benedetto at gmail.com> wrote: >> but I still haven't figure out how to build for cortex-m3 >> >> clang -march=armv7-m -mfloat-abi=soft <something missing?> testReference.cpp -c > > -march should have done the trick. > > You can also try -mcpu=cortex-m3, > > or try -ccc-host-triple armv7m-none-gnueabi (or -eabi),I've tried with all of the following $ clang -march=armv7-m -mfloat-abi=soft -triple thumb2-unknown-unknown -integrated-as testReference.cpp -c clang: warning: argument unused during compilation: '-mfloat-abi=soft' clang: warning: argument unused during compilation: '-triple thumb2-unknown-unknown' error: unknown target CPU 'armv7-m' $ clang -march=armv7-m -mfloat-abi=soft -mcpu=cortex-m3 testReference.cpp -c clang: warning: argument unused during compilation: '-mfloat-abi=soft' clang: warning: argument unused during compilation: '-mcpu=cortex-m3' error: unknown target CPU 'armv7-m' $ clang -mcpu=cortex-m3 testReference.cpp -c clang: warning: argument unused during compilation: '-mcpu=cortex-m3' $ clang -march=armv7-m -mfloat-abi=soft -ccc-host-triple armv7m-none-gnueabi testReference.cpp -c fatal error: error in backend: CPU: 'cortex-m3' does not support ARM mode execution!> and possibly -ccc-gcc-name code sourcery's gcc, > > or possibly --sysroot=code sourcery/libcI guess those would be used for the linking part? Anyway thanks for your rapid response. S.
On 18 July 2012 14:57, salvatore benedetto <salvatore.benedetto at gmail.com> wrote:> $ clang -march=armv7-m -mfloat-abi=soft -ccc-host-triple > armv7m-none-gnueabi testReference.cpp -c > fatal error: error in backend: CPU: 'cortex-m3' does not support ARM > mode execution!Ah, yes! Try: $ clang -ccc-host-triple thumbv7m-none-gnueabi testReference.cpp -c Cross compilation in Clang is very broken at the moment. There was some effort to fix this last year, but I guess it lost momentum... -- cheers, --renato http://systemcall.org/