参考Ubuntu搭建ARM Cortex gcc环境。link as following wbsite:
http://fun-tech.se/stm32/gcc/index.php
以下是详细说明:
1. go to root
[jason@localhost]$su -
password: " enter you pass word here"
[root@localhost]$
2. install some tools and get "FunTechCortexMX_gcc"
[root@localhost]$yum install git-core git-doc git-gui gitk
[root@localhost]$mkdir -p ~/stm32/
[root@localhost]$cd ~/stm32/
[root@localhost]$git clone git://github.com/jsiei97/FunTechCortexMX_gcc.git FunTechCortexMX_gcc
3. changed mode for youslef pc
[root@localhost]$chmod 777 -R FunTechCortexMX_gcc
[root@localhost]$cd FunTechCortexMX_gcc
4. edit ubuntu solve_dependencies.sh, changed something for fredora use
[root@localhost]$vim solve_dependencies.sh
#dpkg -L $package_list 2>&1 > /dev/null
rpm -qa $package_list 2>&1 > /dev/null
# sudo aptitude install $package_list
yum install $package_list
5.run script setup.sh, and install arm cortex mx gcc
[root@localhost]$./setup.sh
need with long time here......
6. first build will be errer as follow information(gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) ).
cc1: warnings being treated as errors
../../gas/config/tc-arm.c: In function ‘parse_operands’:
../../gas/config/tc-arm.c:1912:27: error: ‘firsttype$defined’ may be used uninitialized in this function
../../gas/config/tc-arm.c:1912:27: error: ‘firsttype$index’ may be used uninitialized in this function
mv -f .deps/objcopy.Tpo .deps/objcopy.Po
gcc -DHAVE_CONFIG_H -I. -I../../binutils -I. -I../../binutils -I../bfd -I../../binutils/../bfd -I../../binutils/../include -DLOCALEDIR="\"/usr/local/stm32/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wshadow -Werror -g -O2 -MT not-strip.o -MD -MP -MF .deps/not-strip.Tpo -c -o not-strip.o ../../binutils/not-strip.c
mv -f .deps/not-strip.Tpo .deps/not-strip.Po
gcc -DHAVE_CONFIG_H -I. -I../../binutils -I. -I../../binutils -I../bfd -I../../binutils/../bfd -I../../binutils/../include -DLOCALEDIR="\"/usr/local/stm32/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wshadow -Werror -g -O2 -MT wrstabs.o -MD -MP -MF .deps/wrstabs.Tpo -c -o wrstabs.o ../../binutils/wrstabs.c
make[4]: *** [tc-arm.o] Error 1
make[4]: Leaving directory `/root/stm32/stm32-tools/binutils-2.22/build/gas'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/root/stm32/stm32-tools/binutils-2.22/build/gas'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/stm32/stm32-tools/binutils-2.22/build/gas'
make[1]: *** [all-gas] Error 2
make[1]: *** Waiting for unfinished jobs....
.............................
..............................
make[4]: Leaving directory `/root/stm32/stm32-tools/binutils-2.22/build/binutils'
make[3]: Leaving directory `/root/stm32/stm32-tools/binutils-2.22/build/binutils'
make[2]: Leaving directory `/root/stm32/stm32-tools/binutils-2.22/build/binutils'
make[1]: Leaving directory `/root/stm32/stm32-tools/binutils-2.22/build'
make: *** [all] Error 2
Error failure: code 2
Error failure: code 1
Fixed method:
refer website :
http://www.linuxquestions.org/questions/linux-embedded-78/make%5B4%5D-***-%5Btc-arm-o%5D-error-1-a-937019/
https://github.com/jsiei97/FunTechCortexMX_gcc/issues/1
[root@localhost]$vim build_00_binutils.sh
[root@localhost]$:54
added "--disable-werror\" in line 54(follow michaelkleiser )
In "build_00_binutils.sh" in Line 54 I added:
--disable-werror \
after this I start "./steup.sh" and it seems to go.
7. install stm32 gcc, dl, newlibs, done
8. Test stm32 gcc relay(Download example)
[root@localhost]mkdir -p ~/stm32/stm32-example [root@localhost]cd ~/stm32/stm32-example [root@localhost]wget http://olimex.com/dev/soft/arm/STR/STM32-BLINK-LED-GCC-ECLIPSE-projects.rar [root@localhost]unrar x STM32-BLINK-LED-GCC-ECLIPSE-projects.rar [root@localhost]cd projects/stm_h103/[root@localhost]make clean [root@localhost]make9. compile this example error(error information as following)
arm-none-eabi-gcc -I./ -c -fno-common -O0 -g -mcpu=cortex-m3 -mthumb main.c
cc1: error: arm-none-eabi-gcc not can be found .......
10. edit gcc path from ~/.bashrc
[root@localhost]vim ~/.bashrc# STM32 BEGIN
function settool_armcortex(){
#Added by FunTechCortexMX_gcc - ver_2011-04-17-21-gddcd8af-dirty
#Multi process build
export PARALLEL=-j`getconf _NPROCESSORS_ONLN`
#STM32 gcc...
export TOOLPATH_STM32=/usr/local/stm32
export PATH=${TOOLPATH_STM32}/bin:$PATH
echo 'set arm cortex-m3 gcc for linux successful'
}
# STM32 END
11. reset this script and re-make this example
[root@localhost]source ~/.bashrc [root@localhost]make clean[root@localhost]make12. install stm32 mcu gcc and make example successful
if you want gen hex file or elf file for download tools use. and you just only changed makefile 'CP' parameters "-Obinary" to "-O ihex ". you can refer this method in"Linux-Makefile(how to convert .out to .bin, .elf, .hex file)"