First things first: Let’s build a programming environment. I have been playing with text editors, IDEs, and command lines for a while now, and I reached a nice conclusion: whatever works for you and makes you try to improve and be more efficient is the best setup for you.
I am still trying out what works best for me, IDEs hide a lot of the magic and whenever that fails I have to spend a lot of time learning stuff that I am not used to (UGH, mainly linking problems), in that sense forcing myself to learn command line compiling and the art of writing makefiles for larger projects can become a life saver in both worlds. Text editors have a lot of nice features, I’ve played a lot with the free version of sublime text and notepad++ and these editors are an improvement on any IDE editor I’ve used so far. However I’d like to try VIM, I’ve played with it a bit and I love the concept of never having to touch the mouse while working.
So my setup will be completely free:
- OS – Ubuntu 15.04
- Editor – VIM
- Compiler – gcc for ARM (for MCUS) and gcc (for PC side)
- Debugger – OPENOCD and gdb
- Source control – GIT
I’ll be using the TI’s Launchpad Tiva board based on the TM4C123G MCU as this is the board I have to develop code for in my university. Sorry guys, no long explanation here, hopefully I’ll repeat the same drills on my freedomboard and a couple of other boards in the future.
So, bear with me for a while (or if you will use code composer, IAR or other paid tool just jump to the next post) because the setup is a bit boring, but hopefully when I’m done studying I’ll have mastered a couple important programming tools.
There is a very nice tutorial laid out by chrisrm, I used most of it along with information provided by tiva-template which is a blank template with a very nice makefile ready to be used on linux (gotta love open source community). Just follow along chrisrm instructions until you reached #10. Then let’s install openOCD, for me it worked as follows:
cd ~/Embedded git clone git://git.code.sf.net/p/openocd/code mv ./code ./openocd cd openocd ./bootstrap ./configure --enale-ti-icdi --prefix=`pwd`/. make -j3 make install
then we run back to chrisrm’s tutorial make the template and flash it! Hurray, our system works.Now, to debug:
cd Embedded/openocd/ sudo openocd --file ~/Embedded/openocd/tcl/board/ek-tm4c123gxl.cfg
leave it like that, open a new window and run:
cd Embedded/tiva-template-master/build arm-none-eabi-gdb -ex "target remote localhost:3333" a.out
Ok, system works, let’s wrap up for today.