You are on page 1of 14

Christian's Blog

Linux, programming, hacking, electronics, Python These are the things I love.

December 11, 2012

Getting Started with the TI Stellaris LaunchPad on Linux

TI Stellaris LM4F120 LaunchPad Evaluation Board

Overview
First get a GCC cross compiler for ARM Install the lm4flash tool Build OpenOCD with ICDI support Compile and flash the demo project Debug the example with Nemiver, OpenOCD and GDB Running GDB manually Launchpads serial connection The bad stuff References/Further Reading:

STM32 microcontrollers are very nice and the STM32F0/ STM32VL/ STM32F3/ STM32F4/ STM32L- Discovery boards with the integrated debugger are well supported under Linux, in contrast to the LPCXpresso boards from NXP, so in principle there is no need to look further for other microcontrollers but I like trying new stuff and bought two cheep EK-LM4F120XL Stellaris LM4F120 LaunchPad Evaluation Boards for the promotional price of $4.99 each with free shipping from TI. Im planing to use them with some cheap nRF24L01 wireless modules from eBay, but this is the subject of another blog post.

First get a GCC cross compiler for ARM


Download the latest arm-none-eabi-gcc compiler from Launchpad: https://launchpad.net/gcc-arm-embedded/+download https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q1-update/+download/gcc-armnone-eabi-4_7-2013q1-20130313-linux.tar.bz2 Extract the tarball somewhere and add the compiler to the $ P A T H , e.g. edit your ~ / . b a s h r c file and add a line like this:
e x p o r tP A T H = $ P A T H : $ H O M E / t o o l s / g c c a r m n o n e e a b i 4 _ 7 2 0 1 3 q 1 / b i n

Install the lm4flash tool


[ c h r i s @ t h i n k p a dT I ] $g i tc l o n eh t t p s : / / g i t h u b . c o m / u t z i g / l m 4 t o o l s . g i t [ c h r i s @ t h i n k p a dT I ] $c dl m 4 t o o l s / l m 4 f l a s h / [ c h r i s @ t h i n k p a dl m 4 f l a s h ] $m a k e g c cW a l lgO 2I / u s r / i n c l u d e / l i b u s b 1 . 0 l m 4 f l a s h . cL / l i b 6 4l u s b 1 . 0 ol m 4 f l a s h [ c h r i s @ t h i n k p a dl m 4 f l a s h ] $s u d oc pl m 4 f l a s h/ u s r / b i n / [ c h r i s @ t h i n k p a dl m 4 f l a s h ] $

Build OpenOCD with ICDI support


Now we will build OpenOCD (the Open On-Chip Debugger) with ICDI (in-circuit debug interface) support to flash and debug the LaunchPad. Since ICDI support has been merged into OpenOCD master branch we only need to enable it ( e n a b l e t i i c d i ) when configuring OpenOCD.

[ c h r i s @ t h i n k p a dA R M ] $g i tc l o n eg i t : / / g i t . c o d e . s f . n e t / p / o p e n o c d / c o d e o p e n o c d . g i t [ c h r i s @ t h i n k p a dA R M ] $c do p e n o c d . g i t [ c h r i s @ t h i n k p a do p e n o c d . g i t ] $. / b o o t s t r a p [ c h r i s @ t h i n k p a do p e n o c d . g i t ] $. / c o n f i g u r ep r e f i x = / u s re n a b l e m a i n t a i n e r m o d ee n a b l e s t l i n ke n a b l e t i i c d i [ c h r i s @ t h i n k p a do p e n o c d . g i t ] $m a k e [ c h r i s @ t h i n k p a do p e n o c d . g i t ] $s u d om a k ei n s t a l l

Compile and flash the demo project


Download StellarisWare for the Stellaris LM4F120 LaunchPad Evaluation Board (SW-EKLM4F120XL) from TI: http://www.ti.com/tool/sw-ek-lm4f120xl After the login you should be able to download a file named S W E K L M 4 F 1 2 0 X L 9 4 5 3 . e x e .

Note
As Leo Tindle has pointed out in the comments, the StellarisWare is also available on GitHub: https://github.com/yuvadm/stellaris.
[ c h r i s @ t h i n k p a dT I ] $g i tc l o n eh t t p s : / / g i t h u b . c o m / y u v a d m / s t e l l a r i s . g i t [ c h r i s @ t h i n k p a ds t e l l a r i s . g i t ] $c ds t e l l a r i s . g i t / d r i v e r l i b / [ c h r i s @ t h i n k p a dd r i v e r l i b ] $m a k ec l e a n [ c h r i s @ t h i n k p a dd r i v e r l i b ] $m a k e [ c h r i s @ t h i n k p a dT I ] $c d. . / b o a r d s / e k l m 4 f 1 2 0 x l / p r o j e c t 0 / [ c h r i s @ t h i n k p a dp r o j e c t 0 ] $m a k e C C p r o j e c t 0 . c C C s t a r t u p _ g c c . c L D g c c / p r o j e c t 0 . a x f [ c h r i s @ t h i n k p a dp r o j e c t 0 ] $

Now extract the files (including the demo project):


[ c h r i s @ t h i n k p a d~ ] $m k d i rs t u f f / A R M / T I / S t e l l a r i s W a r e [ c h r i s @ t h i n k p a d~ ] $c ds t u f f / A R M / T I / S t e l l a r i s W a r e [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $u n z i p~ / D o w n l o a d s / S W E K L M 4 F 1 2 0 X L 9 4 5 3 . e x e A r c h i v e : / h o m e / c h r i s / D o w n l o a d s / S W E K L M 4 F 1 2 0 X L 9 4 5 3 . e x e i n f l a t i n g :E U L A . t x t i n f l a t i n g :l i c e n s e . h t m l i n f l a t i n g :m a k e d e f s i n f l a t i n g :M a k e f i l e i n f l a t i n g :m a n i f e s t . h t m l . . . [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $

Compile everything:

[ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $m a k e m a k e [ 1 ] :E n t e r i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / d r i v e r l i b ' m a k e [ 2 ] :E n t e r i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / d r i v e r l i b ' C C a d c . c C C c a n . c . . . C C . . / . . / . . / u t i l s / u a r t s t d i o . c L D g c c / c a p s e n s e . a x f m a k e [ 3 ] :L e a v i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / b o a r d s / e k l m 4 f 1 2 0 x l b o o s t c a p s e n s e / c a p s e n s e ' m a k e [ 2 ] :L e a v i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / b o a r d s / e k l m 4 f 1 2 0 x l b o o s t c a p s e n s e ' m a k e [ 1 ] :L e a v i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / b o a r d s ' [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $

Add a new udev rule to let normal users access the LaunchPad and program it with OpenOCD:
[ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $s u d ov i m/ e t c / u d e v / r u l e s . d / 1 0 l o c a l . r u l e s [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $c a t/ e t c / u d e v / r u l e s . d / 1 0 l o c a l . r u l e s A T T R { i d V e n d o r } = = " 1 5 b a " ,A T T R { i d P r o d u c t } = = " 0 0 0 4 " ,G R O U P = " p l u g d e v " ,M O D E = " 0 6 6 0 " #O l i m e xL t d .O p e n O C DJ T A GT I N Y A T T R { i d V e n d o r } = = " 0 6 7 b " ,A T T R { i d P r o d u c t } = = " 2 3 0 3 " ,G R O U P = " p l u g d e v " ,M O D E = " 0 6 6 0 " #P r o l i f i cT e c h n o l o g y ,I n c .P L 2 3 0 3S e r i a lP o r t A T T R { i d V e n d o r } = = " 1 0 c 4 " ,A T T R { i d P r o d u c t } = = " e a 6 0 " ,G R O U P = " p l u g d e v " ,M O D E = " 0 6 6 0 " #U S BS e r i a l A T T R { i d V e n d o r } = = " 1 c b e " ,A T T R { i d P r o d u c t } = = " 0 0 f d " ,G R O U P = " p l u g d e v " ,M O D E = " 0 6 6 0 " #T IS t e l l a r i sL a u n c h p a d [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $s u d ou d e v a d mc o n t r o lr e l o a d r u l e s

If it still does not work you can try this:


[ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $s u d og r o u p a d dp l u g d e v [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $s u d ou s e r m o da Gp l u g d e vc h r i s# r e p l a c ec h r i s w i t hy o u ru s e r n a m e [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $s u d ou s e r m o da Gd i a l o u tc h r i s [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $s u d or e b o o t

Modify the M a k e f i l ein S t e l l a r i s W a r e / b o a r d s / e k l m 4 f 1 2 0 x l / p r o j e c t 0 /and add the flash rule (use a tabulator for indention like in the other make targets):
# #T h ed e f a u l tr u l e ,w h i c hc a u s e st h eP r o j e c tZ e r oE x a m p l et ob eb u i l t . # a l l :$ { C O M P I L E R } a l l :$ { C O M P I L E R } / p r o j e c t 0 . a x f # #T h er u l et of l a s ht h ep r o g r a mt ot h ec h i p . # f l a s h : l m 4 f l a s hg c c / p r o j e c t 0 . b i n

Now you should be able to flash the board when running m a k ef l a s h :

[ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $c db o a r d s / e k l m 4 f 1 2 0 x l / p r o j e c t 0 / [ c h r i s @ t h i n k p a dp r o j e c t 0 ] $m a k ec l e a n [ c h r i s @ t h i n k p a dp r o j e c t 0 ] $m a k e C C p r o j e c t 0 . c C C s t a r t u p _ g c c . c L D g c c / p r o j e c t 0 . a x f [ c h r i s @ t h i n k p a dp r o j e c t 0 ] $m a k ef l a s h l m 4 f l a s hg c c / p r o j e c t 0 . b i n F o u n dI C D Id e v i c ew i t hs e r i a l :0 E 1 0 2 3 9 7 I C D Iv e r s i o n :9 2 7 0 [ c h r i s @ t h i n k p a dp r o j e c t 0 ] $

Debug the example with Nemiver, OpenOCD and GDB


Make sure Nemiver is installed:
[ c h r i s @ t h i n k p a dp r o j e c t 0 ] $s u d oy u mi n s t a l ln e m i v e r

Add another rule to the M a k e f i l e :


# #T h er u l et or e b u i l dt h ep r o j e c ta n dd e b u gi tw i t hN e m i v e r . # d e b u g :c l e a n d e b u g :C F L A G S + = gDD E B U G d e b u g :$ { C O M P I L E R } d e b u g :$ { C O M P I L E R } / p r o j e c t 0 . a x f d e b u g : . / d e b u g _ n e m i v e r . s h

d e b u g _ n e m i v e r . s h :
# ! / b i n / b a s h #l o c a t i o no fO p e n O C DB o a r d. c f gf i l e s O P E N O C D _ B O A R D _ D I R = / u s r / s h a r e / o p e n o c d / s c r i p t s / b o a r d #s t a r tx t e r mw i t ho p e n o c di nt h eb a c k g r o u n d x t e r meo p e n o c df$ O P E N O C D _ B O A R D _ D I R / e k l m 4 f 1 2 0 x l . c f g& #s a v et h eP I Do ft h eb a c k g r o u n dp r o c e s s X T E R M _ P I D = $ ! #w a i tab i tt ob es u r et h eh a r d w a r ei sr e a d y s l e e p2 #e x e c u t es o m ei n i t i a l i s a t i o nc o m m a n d sv i ag d b a r m n o n e e a b i g d bb a t c hc o m m a n d = i n i t . g d bg c c / p r o j e c t 0 . a x f #s t a r tt h eg d bg u i n e m i v e rr e m o t e = l o c a l h o s t : 3 3 3 3g d b b i n a r y = " $ ( w h i c ha r m n o n e e a b i g d b ) " g c c / p r o j e c t 0 . a x f #c l o s ex t e r mw h e nt h eu s e rh a se x i t e dn e m i v e r k i l l$ X T E R M _ P I D

i n i t . g d b :

#S p e c i f yr e m o t et a r g e t t a r g e te x t e n d e d r e m o t e: 3 3 3 3 #R e s e tt ok n o w ns t a t e m o n i t o rr e s e th a l t l o a d m o n i t o rr e s e ti n i t #S e tab r e a k p o i n ta tm a i n ( ) . b r e a km a i n #R u nt ot h eb r e a k p o i n t . c o n t i n u e

After this everything you have to do to start a new debug session is to run m a k ed e b u g :
[ c h r i s @ t h i n k p a dp r o j e c t 0 ] $m a k ed e b u g C C p r o j e c t 0 . c C C s t a r t u p _ g c c . c L D g c c / p r o j e c t 0 . a x f . / d e b u g _ n e m i v e r . s h 0 x 0 0 0 0 0 0 0 0i ng _ p f n V e c t o r s( ) t a r g e ts t a t e :h a l t e d t a r g e th a l t e dd u et od e b u g r e q u e s t ,c u r r e n tm o d e :T h r e a d x P S R :0 x 0 1 0 0 0 0 0 0p c :0 x 0 0 0 0 0 2 b cm s p :0 x 2 0 0 0 0 1 0 0 L o a d i n gs e c t i o n. t e x t ,s i z e0 x 5 e 4l m a0 x 0 S t a r ta d d r e s s0 x 2 b d ,l o a ds i z e1 5 0 8 T r a n s f e rr a t e :6K B / s e c ,1 5 0 8b y t e s / w r i t e . t a r g e ts t a t e :h a l t e d t a r g e th a l t e dd u et od e b u g r e q u e s t ,c u r r e n tm o d e :T h r e a d x P S R :0 x 0 1 0 0 0 0 0 0p c :0 x 0 0 0 0 0 2 b cm s p :0 x 2 0 0 0 0 1 0 0 B r e a k p o i n t1a t0 x 2 6 e :f i l ep r o j e c t 0 . c ,l i n e6 8 . N o t e :a u t o m a t i c a l l yu s i n gh a r d w a r eb r e a k p o i n t sf o rr e a d o n l ya d d r e s s e s . B r e a k p o i n t1 ,m a i n( )a tp r o j e c t 0 . c : 6 8 6 8 S y s C t l C l o c k S e t ( S Y S C T L _ S Y S D I V _ 4 | S Y S C T L _ U S E _ P L L | S Y S C T L _ X T A L _ 1 6 M H Z |

Now you have an easy and fast way to debug your programs.

Running $ m a k ed e b u g

You may need to rebuild all libraries in debug mode to have debugging information available for library functions:
[ c h r i s @ t h i n k p a dp r o j e c t 0 ] $c d. . / . . / . . / [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $m a k ec l e a n m a k e [ 1 ] :E n t e r i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / d r i v e r l i b ' . . . [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $m a k eD E B U G = 1 m a k e [ 1 ] :E n t e r i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / d r i v e r l i b ' m a k e [ 2 ] :E n t e r i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / d r i v e r l i b ' C C a d c . c C C c a n . c C C c o m p . c C C c p u . c . . . L D g c c / p r o j e c t 0 . a x f . . / . . / . . / d r i v e r l i b / g c c c m 4 f / l i b d r i v e r c m 4 f . a ( g p i o . o ) :I nf u n c t i o n ` G P I O D i r M o d e S e t ' : / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / d r i v e r l i b / g p i o . c : 2 8 8 :u n d e f i n e d r e f e r e n c et o` _ _ e r r o r _ _ ' . . . m a k e [ 3 ] :* * *[ g c c / p r o j e c t 0 . a x f ]E r r o r1 m a k e [ 3 ] :L e a v i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / b o a r d s / e k l m 4 f 1 2 0 x l / p r o j e c t 0 ' m a k e [ 2 ] :* * *[ a l l ]E r r o r2 m a k e [ 2 ] :L e a v i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / b o a r d s / e k l m 4 f 1 2 0 x l ' m a k e [ 1 ] :* * *[ a l l ]E r r o r2 m a k e [ 1 ] :L e a v i n gd i r e c t o r y` / h o m e / c h r i s / s t u f f / A R M / T I / S t e l l a r i s W a r e / b o a r d s ' m a k e :* * *[ a l l ]E r r o r2 [ c h r i s @ t h i n k p a dS t e l l a r i s W a r e ] $

Theoretical this should work, it is explicitly stated in S t e l l a r i s W a r e / m a k e d e f s :


# #T e l lt h ec o m p i l e rt oi n c l u d ed e b u g g i n gi n f o r m a t i o ni ft h eD E B U Ge n v i r o n m e n t #v a r i a b l ei ss e t . # i f d e fD E B U G C F L A G S + = gDD E B U G e n d i f

http://e2e.ti.com/support/microcontrollers/stellaris_arm_cortexm3_microcontroller/f/471/t/44656.aspx:

The undefined reference to __error__ problem you are seeing most likely indicates that you have a mismatch between debug and release versions of the DriverLib library you are linking and your application code. Alternatively, you may be using the ASSERT() macro without having defined the __error__() function in your application. In a debug build (when you define label DEBUG either in your IDE or using DDEBUG passed to your compiler), error checking code is included in DriverLib via the macro ASSERT(). This macro generates a call to function __error__ if the assert fails and it is expected that the application code will include this function. Typically, all it does is enter a while(1) to stop execution and allow you to debug the problem but you can also add other code there to dump status or provide other useful information. To get rid of the problem, you have a couple of choiced. First, you can rebuild DriverLib without DEBUG defined then link this version to your application code (assuming you dont use ASSERT() anywhere in the app). The other option, if you want to use the debug features, is to add a function to your application along the lines of the following:
# i f d e fD E B U G v o i d_ _ e r r o r _ _ ( c h a r* p c F i l e n a m e ,u n s i g n e dl o n gu l L i n e ) { / / / /S o m e t h i n gh o r r i b l eh a p p e n e d !Y o un e e dt ol o o k / /a tf i l e" p c F i l e n a m e "a tl i n e" u l L i n e "t os e e / /w h a te r r o ri sb e i n gr e p o r t e d . / / w h i l e ( 1 ) { } } # e n d i f

After adding that function to p r o j e c t 0 . ccompiling in debug mode is successful and debugging information is available for the underlying library functions:

Debugging project0 with Nemiver

Running GDB manually


First terminal:
[ c h r i s @ t h i n k p a dp r o j e c t 0 ] $m a k ec l e a n [ c h r i s @ t h i n k p a dp r o j e c t 0 ] $m a k eD E B U G = 1 C C p r o j e c t 0 . c C C s t a r t u p _ g c c . c L D g c c / p r o j e c t 0 . a x f [ c h r i s @ t h i n k p a dp r o j e c t 0 ] $o p e n o c df/ u s r / s h a r e / o p e n o c d / s c r i p t s / b o a r d / e k l m 4 f 1 2 0 x l . c f g O p e nO n C h i pD e b u g g e r0 . 8 . 0 d e v 0 0 0 1 1 g 7 0 a 2 f f a( 2 0 1 3 0 5 1 6 1 8 : 5 0 ) L i c e n s e du n d e rG N UG P Lv 2 F o rb u gr e p o r t s ,r e a d h t t p : / / o p e n o c d . s o u r c e f o r g e . n e t / d o c / d o x y g e n / b u g s . h t m l I n f o:T h i sa d a p t e rd o e s n ' ts u p p o r tc o n f i g u r a b l es p e e d I n f o:I C D IF i r m w a r ev e r s i o n :9 2 7 0 I n f o:l m 4 f 1 2 0 h 5 q r . c p u :h a r d w a r eh a s6b r e a k p o i n t s ,4w a t c h p o i n t s

Second terminal:

[ c h r i s @ t h i n k p a dp r o j e c t 0 ] $a r m n o n e e a b i g d bg c c / p r o j e c t 0 . a x f G N Ug d b( G N UT o o l sf o rA R ME m b e d d e dP r o c e s s o r s )7 . 4 . 1 . 2 0 1 3 0 3 1 2 c v s C o p y r i g h t( C )2 0 1 2F r e eS o f t w a r eF o u n d a t i o n ,I n c . L i c e n s eG P L v 3 + :G N UG P Lv e r s i o n3o rl a t e r< h t t p : / / g n u . o r g / l i c e n s e s / g p l . h t m l > T h i si sf r e es o f t w a r e :y o ua r ef r e et oc h a n g ea n dr e d i s t r i b u t ei t . T h e r ei sN OW A R R A N T Y ,t ot h ee x t e n tp e r m i t t e db yl a w . T y p e" s h o wc o p y i n g " a n d" s h o ww a r r a n t y "f o rd e t a i l s . T h i sG D Bw a sc o n f i g u r e da s" h o s t = i 6 8 6 l i n u x g n ut a r g e t = a r m n o n e e a b i " . F o rb u gr e p o r t i n gi n s t r u c t i o n s ,p l e a s es e e : < h t t p : / / w w w . g n u . o r g / s o f t w a r e / g d b / b u g s / > . . . R e a d i n gs y m b o l sf r o m/ h o m e / c h r i s / P r o j e c t s / A R M / T I / s t e l l a r i s . g i t / b o a r d s / e k l m 4 f 1 2 0 x l / p r o j e c t 0 / g c c / p r o j e c t 0 . a x f . . . d o n e . ( g d b )t a r g e te x t e n d e d r e m o t e: 3 3 3 3 R e m o t ed e b u g g i n gu s i n g: 3 3 3 3 0 x 0 0 0 0 0 0 0 0i ng _ p f n V e c t o r s( ) ( g d b )m o n i t o rr e s e th a l t t a r g e ts t a t e :h a l t e d t a r g e th a l t e dd u et od e b u g r e q u e s t ,c u r r e n tm o d e :T h r e a d x P S R :0 x 0 1 0 0 0 0 0 0p c :0 x 0 0 0 0 0 a f 4m s p :0 x 2 0 0 0 0 9 1 0 ( g d b )l o a d L o a d i n gs e c t i o n. t e x t ,s i z e0 x 9 f 8l m a0 x 0 S t a r ta d d r e s s0 x 2 b d ,l o a ds i z e2 5 5 2 T r a n s f e rr a t e :7K B / s e c ,2 5 5 2b y t e s / w r i t e . ( g d b )m o n i t o rr e s e ti n i t t a r g e ts t a t e :h a l t e d t a r g e th a l t e dd u et od e b u g r e q u e s t ,c u r r e n tm o d e :T h r e a d x P S R :0 x 0 1 0 0 0 0 0 0p c :0 x 0 0 0 0 0 2 b cm s p :0 x 2 0 0 0 0 1 0 0 ( g d b )m o n i t o rr e s e ti n i t t a r g e ts t a t e :h a l t e d t a r g e th a l t e dd u et od e b u g r e q u e s t ,c u r r e n tm o d e :T h r e a d x P S R :0 x 0 1 0 0 0 0 0 0p c :0 x 0 0 0 0 0 2 b cm s p :0 x 2 0 0 0 0 1 0 0 ( g d b )r u n T h ep r o g r a mb e i n gd e b u g g e dh a sb e e ns t a r t e da l r e a d y . S t a r ti tf r o mt h eb e g i n n i n g ?( yo rn )y S t a r t i n gp r o g r a m :/ h o m e / c h r i s / P r o j e c t s / A R M / T I / s t e l l a r i s . g i t / b o a r d s / e k l m 4 f 1 2 0 x l / p r o j e c t 0 / g c c / p r o j e c t 0 . a x f c ^ C 0 x 0 0 0 0 0 8 7 6i nS y s C t l D e l a y( u l C o u n t = 1 7 6 3 5 5 4 ,u l C o u n t @ e n t r y = 2 0 0 0 0 0 0 )a t s y s c t l . c : 1 8 5 6 1 8 5 6 _ _ a s m ( " s u b s r 0 ,# 1 \ n " ( g d b )c C o n t i n u i n g . ^ C P r o g r a mr e c e i v e ds i g n a lS I G I N T ,I n t e r r u p t . S y s C t l D e l a y( u l C o u n t = 1 3 6 1 5 ,u l C o u n t @ e n t r y = 2 0 0 0 0 0 0 )a ts y s c t l . c : 1 8 5 6 1 8 5 6 _ _ a s m ( " s u b s r 0 ,# 1 \ n " ( g d b )b r e a kp r o j e c t 0 . c : 8 5 B r e a k p o i n t1a t0 x 2 8 2 :f i l ep r o j e c t 0 . c ,l i n e8 5 . ( g d b )c C o n t i n u i n g . N o t e :a u t o m a t i c a l l yu s i n gh a r d w a r eb r e a k p o i n t sf o rr e a d o n l ya d d r e s s e s . B r e a k p o i n t1 ,m a i n( )a tp r o j e c t 0 . c : 8 5 8 5 G P I O P i n W r i t e ( G P I O _ P O R T F _ B A S E ,R E D _ L E D | B L U E _ L E D | G R E E N _ L E D , R E D _ L E D ) ; ( g d b )

Launchpads serial connection

The USART of the target processor is available through ICDI as / d e v / t t y A C M 0 ,


/ d e v / t t y A C M 2or / d e v / t t y A C M 3under Linux.
[ c h r i s @ t h i n k p a dp r o j e c t 0 ] $c d. . / q s r g b / [ c h r i s @ t h i n k p a dq s r g b ] $m a k e m a k e :N o t h i n gt ob ed o n ef o r` a l l ' . [ c h r i s @ t h i n k p a dq s r g b ] $l m 4 f l a s hg c c / q s r g b . b i n F o u n dI C D Id e v i c ew i t hs e r i a l :0 E 1 0 2 3 9 7 [ c h r i s @ t h i n k p a dq s r g b ] $s u d os c r e e n/ d e v / t t y A C M 31 1 5 2 0 0 W e l c o m et ot h eS t e l l a r i sL M 4 F 1 2 0L a u n c h P a d ! T y p e' h e l p 'f o ral i s to fc o m m a n d s >E x t e r n a lo ro t h e rr e s e t > > h e l p h e l p :D i s p l a yl i s to fc o m m a n d s h i b :P l a c es y s t e mi n t oh i b e r n a t em o d e r a n d :S t a r ta u t o m a t i cc o l o rs e q u e n c i n g i n t e n s i t y :A d j u s tb r i g h t n e s s0t o1 0 0p e r c e n t r g b :A d j u s tc o l o r0 0 0 0 0 0 F F F F F FH T M Ln o t a t i o n > r g b0 0 0 E E E > [ s c r e e ni st e r m i n a t i n g ] [ c h r i s @ t h i n k p a dq s r g b ] $

The bad stuff


Some of the example files from the StellarisWare have a really ugly license:
/ /T e x a sI n s t r u m e n t s( T I )i ss u p p l y i n gt h i ss o f t w a r ef o ru s es o l e l ya n d / /e x c l u s i v e l yo nT I ' sm i c r o c o n t r o l l e rp r o d u c t s .T h es o f t w a r ei so w n e db y / /T Ia n d / o ri t ss u p p l i e r s ,a n di sp r o t e c t e du n d e ra p p l i c a b l ec o p y r i g h t / /l a w s .Y o um a yn o tc o m b i n et h i ss o f t w a r ew i t h" v i r a l "o p e n s o u r c e / /s o f t w a r ei no r d e rt of o r mal a r g e rp r o g r a m .

You know I mean the viral open-source part. And TI please fix your website, lots of 404 links, just use such a viral open-source script to check all links.

References/Further Reading:
http://www.ti.com/tool/EK-LM4F120XL http://processors.wiki.ti.com/index.php/Stellaris_LaunchPad http://processors.wiki.ti.com/index.php/Stellaris_Launchpad_with_OpenOCD_and_Linux http://www.ti.com/ww/en/launchpad/stellaris_head.html http://www.ti.com/product/lm4f120h5qr http://hackaday.com/tag/stellaris-launchpad/ http://recursive-labs.com/blog/2012/10/28/stellaris-launchpad-gnu-linux-getting-started/ https://eehusky.wordpress.com/2012/12/04/using-gcc-with-ti-stellaris-launchpad-amore-in-depth-look/

http://kernelhacks.blogspot.com.es/2012/11/the-complete-tutorial-for-stellaris_25.html https://github.com/scompo/stellaris-launchpad-template-gcc http://www.fischl.de/arm/sllogiclogger_logic_analyser_for_stellaris_launchpad/


Posted by Christian Jann Filed under: English Tags: ARM, TI, HOWTO, C, Programming, Linux, Stellaris, LaunchPad, Nemiver, OpenOCD

8 Comments
Sort by Oldest

jann.cc
Share

Login
Favorite

Join the discussion


willprice94

a year ago

Thanks for the post, I'll certainly be referring to this when my Stellaris arrives.
Reply Share

S Leo Tindle

a year ago

You might be interested to know that the StellarisWare drivers are now under the TI BSD License. The version of StellarisWare you cite (9453) is under this license. Just look at the license section of any of the driver source files and the TI-BSD-EULA.txt file at the root of the extracted SW-EK-LM4F120XL-9453.exe archive. It looks like they forgot to change the license header on the examples, though. BTW, very informative post. Helped get up and running on Kubuntu 12.10.
Reply Share

Christian Jann

Mod

S Leo Tindle a year ago

Thank you for pointing this out, I've seen that some files have a better license but I'm more interested in the question whether it is allowed to copy the StellarisWare to GitHub and why nobody has done this already. It would be so much nicer if I could do a g i tc l o n eto get the StellarisWare and a g i tp u l lto check for updates so that I can easily integrate the StellarisWare into my project without telling everybody that they have to register at TI and get the StellarisWare from there. OK I've found the reason, now I have to complain abut the EULA (TI StellarisWare Crippleware Software License Agreement (SLA)): g. Restrictions. You shall maintain the source code versions of the Licensed Materials under password control protection and shall not disclose such source code versions of the Licensed Materials, or any derivative thereof, to any person other than your employees and contractors whose job performance requires access.
Reply Share

S Leo Tindle

Christian Jann a year ago

S Leo Tindle

Christian Jann a year ago

Sorry, Christian, I forgot to add the github link. Someone already has: https://github.com/yuvadm/stel.... It may not be official, but TI hasn't tried to take it down yet. Yeah, their EULA sucks, but the license for the driver lib is under BSD explicitly which means you can pull the BSD code out and use it wherever. I have half a mind to just write a bootstrap that pulls all the needed components from github in to a virtual environment. I modified your instructions so that all the software compiled exist in ~/workspace/stellarisware/usr and added ~/workspace/stellarisware/usr/bin to my PATH. A simple bash file can do the modification to the PATH and other variables not unlike how virtenv asks you to source a bash file to enter the environment.
1
Reply Share

Christian Jann

Mod

S Leo Tindle a year ago

Very nice, I must have overseen that when googling, thank you. I've added a link.
Reply Share

JohnCC

S Leo Tindle 2 days ago

Note that the Note is inserted in an unlucky place (above). It gives the impression that some other compilation is necessary after the instructions for the Note itself. And, the cd stellaris.git should be just cd stellaris. Other than that, thanks for the info! The git copy is still up and working.
Reply Share

Name

11 months ago

I don't think TI means harm by calling some open source licenses viral, it's quite a common term. http://en.wikipedia.org/wiki/V...
1
Reply Share

Christian Jann

Mod

Name 9 months ago

Yes, I know, they are just lazy and following another philosophy and don't care about the open source community. Like most corporations they don't have a "keep it open, unless there's a good reason to close it" mentality. Instead, they have a "keep it closed, unless there's a good/legal reason to open it" mentality. Even when there is no reason to not release such small hello-world examples as public domain they will keep it closed. Probably they think that they can make you dependent on their hardware through their software which is perfectly viable but I don't like it.
Reply Share

ALSO ON JANN.CC

WHAT'S THIS?

Building ROS on Fedora 19


12 comments 10 months ago

Tiny, hackable (?) quadcopter from China for EUR 22 / USD 35

12 comments 10 months ago

EUR 22 / USD 35
3 comments 4 months ago

Christian Jann Maybe the Fedora

Robotics SIG will integrate it into Fedora: Fedora Robotics ML:

panda It seems that we can now control

the toy quadcopter by arduino & nrf24L01. That's great!

iMX233-OLinuXino: Current State


13 comments 9 months ago

Review: Saleae Logic16 Logic Analyzer


4 comments 2 months ago

Christian Jann Thanks, I've fixed it in the

Christian Jann Thanks for the tip, indeed

post above.

it is supported: http://sigrok.org/wiki/Saleae_.... But for

Copyright 2013, Christian Jann. Powered by Tinkerer and Sphinx.

You might also like