วันศุกร์ที่ 22 สิงหาคม พ.ศ. 2551

GCC 4.3.1 สำหรับ ARM (รองรับ Cortex-M3) บน Mac OS X และ Linux

สำหรับใครที่ใช้ Mac OS X อยู่แล้วอยากลองพัฒนาโปรแกรมสำหรับ ARM นะครับ

บทความนี้จะเน้นสำหรับ STM32 (ARM Cortex-M3) จากค่าย ST นะครับ

http://www.paintyourdragon.com/uc/osxstm32/index.html

ยกเว้นขั้นตอนการ Build และ Install GCC และ Newlib
สามารถหลีกเลี่ยงไม่ให้เกิดปัญหาตามที่ระบุในข้อที่ 3
โดยการสร้างไดเรกทอรีใหม่สำหรับ Build แทนที่จะทำการ Build
ภายในไดเรกทอรีซอร์สโค้ดโดยตรง ดังนั้นในขั้นตอนที่ 2 ให้แก้เป็น

cd ~/Desktop/stm32/gcc-4.3.1 (or present GCC version)

ln -s ../newlib-1.16.0/newlib . (ditto, and note there's a
space before the period)

mkdir -p ~/Desktop/stm32/gcc-4.3.1-build (make build directory for GCC)

cd ~/ Desktop/stm32/gcc-4.3.1-build

../gcc-4.3.1/configure --prefix=/usr/local/stm32 --target=arm-none-eabi \
--enable-languages=c --enable-multilib \
--disable-libgomp --disable-libmudflap --disable-libssp \
--disable-libstdcxx-pch --disable-nls --disable-shared \
--disable-threads --with-gnu-as --with-gnu-ld \
--with-float=soft --with-newlib

(The entire "configure" block needs to be entered as a single
command. The end-of-line backslashes should allow you to copy and
paste the text from this page to the Terminal window.)

make (This will take a bit longer than the others…have a
sandwich or walk the dog or something.)

sudo make install

อย่างไรก็ตาม คนที่ใช้ Linux อยู่ แทนที่จะใช้ CodeSourcery G++ Lite
Edition เข้าใจว่าเป็นตัวเดียวในตอนนี้ (2008/08/22) ที่ฟรีและรองรับ ARM
Cortex ก็สามารถคอมไพล์ตามขั้นตอนดังกล่าวได้เช่นเดียวกัน (ผมลองกับ
Debian Etch)

ส่วนใครที่ใช้ Windows ก็อาจจะลองนำไปคอมไพล์ดูได้นะครับ

1 ความคิดเห็น:

Helios กล่าวว่า...

ไปเจอมาอีกอันนึง บนลีนุกซ์

http://elua.berlios.de/tut_gcc_cortex.html

แต่จะ target เป็น arm-elf