STM32/ARM Cortex-M3 HOWTO: Development under Ubuntu (Debian)

Install Sourcery CodeBench Lite Edition for ARM EABI

Don't feel like doing all the compiler testing your self? Well in that case, let's install the Sourcery CodeBench Lite Edition for ARM EABI (used to be known as CodeSourcery g++).

The short version is, download the installer and read the getting started guide.

The main page for Sourcery CodeBench is over at mentor.com, and we are using the Sourcery CodeBench Lite Edition for ARM EABI.

And in this guide I am using release1802 also know as Sourcery G++ Lite 2011.03-42 for ARM EABI, https://sourcery.mentor.com/sgpp/lite/arm/portal/release1802.

First download the docs so we can read them when we need some help.

# First create a work dir
mkdir -p ~/stm32/CodeBench/
cd ~/stm32/CodeBench/
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11457/as.pdf &
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11456/binutils.pdf &
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11464/libc.pdf &
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11460/gcc.pdf &
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11462/gdb.pdf &
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11463/getting-started.pdf &
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11458/ld.pdf &
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11465/libm.pdf &
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11461/cpp.pdf &
wget -nv https://sourcery.mentor.com/sgpp/lite/arm/portal/doc11459/gprof.pdf &
wait

Then start the installation by doing some cut and paste into your terminal.

cd ~/stm32/CodeBench/

# Open the installation manual, so you can read it if you need to...
evince getting-started.pdf &

# Get the installer
wget https://sourcery.mentor.com/sgpp/lite/arm/portal/package8736/public/arm-none-eabi/arm-2011.03-42-arm-none-eabi.bin

# CodeBench has a problem with dash, so make sure you don't use it. 
sudo dpkg-reconfigure -plow dash
#And then answer No

# Now bash is the default /bin/sh and not dash!
ls -lh /bin/sh

# Create the install dir.
sudo mkdir -p  /usr/local/CodeBench_1802_EABI
sudo chown $USER.users  /usr/local/CodeBench_1802_EABI

# And create a add to path script
echo "export PATH=/usr/local/CodeBench_1802_EABI/bin:\$PATH" > ~/stm32/bin/CodeBench_setup.sh 

Then we start the installer.

/bin/sh arm-2011.03-42-arm-none-eabi.bin

Then when you need this compiler you run this script.

source ~/stm32/bin/CodeBench_setup.sh 
Fatal error: Uncaught Error: Call to a member function link_ext() on null in /customers/9/b/5/fun-tech.se/httpd.www/stm32/class.page.php:62 Stack trace: #0 /customers/9/b/5/fun-tech.se/httpd.www/stm32/CodeSourceryInstall/index.php(39): page->getFoot() #1 {main} thrown in /customers/9/b/5/fun-tech.se/httpd.www/stm32/class.page.php on line 62