llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.43k stars 12.16k forks source link

error: unknown target CPU 'cortex-m3' #8857

Closed llvmbot closed 13 years ago

llvmbot commented 14 years ago
Bugzilla Link 8485
Resolution FIXED
Resolved on Jan 06, 2011 10:57
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @asl

Extended Description

Hi!

I just wanted to give clang/llvm a try to compile for a small embedded STM32 ARM Cortex-M3 target. I'm working from a fresh cygwin install on Windows 7.

I did everything as listed on the clang getting started page:

$ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm $ cd llvm/tools $ svn co http://llvm.org/svn/llvm-project/cfe/trunk clang $ cd ..

$ ./configure --enable-optimized --disable-assertions

$ time make -j4 real 16m55.481s user 40m12.278s sys 7m13.942s

$ make install

$ clang --version clang version 2.9 (trunk 117454) Target: i386-pc-cygwin Thread model: posix

Everything's fine so far. I've tried a plain vanilla hello-world:

incude

int main() { printf("Hello World!\n"); return 1; }

Compiling for armv7 (== cortex-a8 ?) seems to work:

$ clang -ccc-host-triple armv7-none-eabi -S -o - foo.c clang: warning: unknown platform, assuming -mfloat-abi=soft .syntax unified .cpu cortex-a8 [...] main: sub sp, sp, #​8 str lr, [sp, #​4] str r11, [sp] mov r11, sp [...]

But compiling for arm7m (the STM32 is a Cortex-M3) fails:

$ clang -ccc-host-triple armv7m-none-eabi -S -o - foo.c clang: warning: unknown platform, assuming -mfloat-abi=soft error: unknown target CPU 'cortex-m3'

What did I do wrong?

best regards, Thomas Kindler

llvmbot commented 13 years ago

Thanks for the reminder. I applied the patch as svn r122965.

llvmbot commented 13 years ago

BUMP

As I said in Comment #​4, the patch solved the problem for me!

Could someone please commit the patch to the repository?

llvmbot commented 14 years ago

please try this patch

Sorry for my previous reply!

It works!!! (only forgot to add -mthumb)

llvmbot commented 14 years ago

please try this patch

Thanks for your fast reply! Unfortunately, it still doesn't work:

$ llvm/Release/bin/clang -ccc-host-triple armv7m-none-eabi -S -o - foo.c clang: warning: unknown platform, assuming -mfloat-abi=soft fatal error: error in backend: CPU: 'cortex-m3' does not support ARM mode execution!

llvmbot commented 14 years ago

please try this patch

llvmbot commented 14 years ago

add cortex-m3 to getCPUDefineSuffix mapping