Author Topic: Looking into CodeBlocks and CodeSourcery  (Read 13874 times)

Offline jmhill

  • Single posting newcomer
  • *
  • Posts: 4
Looking into CodeBlocks and CodeSourcery
« on: October 23, 2011, 11:33:57 pm »
Hello Folks;

I've been happily running CodeBlocks, writing non-embedded applications.  CodeBlocks is convenient to use on both Linux as well as Windows.

I've long seen the ARM new project wizard icon and have been curious.  Over a year ago I had a start with CodeSourcery lite which is command line only, without an IDE.  I was distracted and was not able to follow through.

So, please, is developing embedded applications with CodeBlocks worth doing?  What hurdles did you overcome or need to overcome?  What tools do you use with CodeBlocks?

Best;
Jonathan

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Looking into CodeBlocks and CodeSourcery
« Reply #1 on: October 24, 2011, 12:07:10 am »
Hm, I guess it depends on the board you have for programming. (I'm not embedded programmer myself)
What compiler it requires?
What is the method for sending the compiled code to the board?
Is there a simulator?
Does it support remote debugging with GDB or any other debugger.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jmhill

  • Single posting newcomer
  • *
  • Posts: 4
Re: Looking into CodeBlocks and CodeSourcery
« Reply #2 on: October 24, 2011, 03:02:38 am »
Thank you for replying.

I'm using an Atmel AT91SAM7S256 chip, it's an ARM7 chip with 256K bytes of flash
and 64K bytes of RAM.

The CodeSourcery lite package contains gcc, binutils, gdb, a simulator among other things.
I've built a simple example that calculates factorials and I used the simulator and gdb
to run it.

The chip is on a board from Olimex, it's a SAM7-P256 board.  I'm going to use a tool
with JTAG which supports the gdb remote protocol, so that I'll be able to use gdb.
I was struggling with the ARM-USB-OCD JTAG adapter which works with OpenOCD, so
I'll give the Segger J-Link JTAG adapter a try, when it arrives. 

Given that I can now use gdb with the simulator to run code that I've built, the next
step is to build a simple example at the command line and run it on actual hardware.
I have example code to study from Atmel.  If that goes well, then I hope to get things
working with CodeBlocks.

'Best;
Jonathan

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Looking into CodeBlocks and CodeSourcery
« Reply #3 on: October 24, 2011, 10:02:02 am »
I've been compiling, linking, programming and debugging (on the actual hardware) Atmel AVR MCUs with avr-gcc using CB for a long time now. There were a couple of problems at first but most of them are solved as of yet. Afaik CodeSourcery is the gcc clone for ARM so u can try messing with it by copying the arm-gcc in CB and adjusting the settings for correct executables. No one can guarantee u won't run into problems though. That's the cost of using open-source. ;) But in the end CB team offers good support imo.

Offline jmhill

  • Single posting newcomer
  • *
  • Posts: 4
Re: Looking into CodeBlocks and CodeSourcery
« Reply #4 on: October 29, 2011, 05:27:15 am »
Thank you for your reply.  I'm glad to hear of your success.

I'm still getting the underlying tools to work.  So far, here are the choices

o Which compiler - I tossed a coin and chose CodeSourcery over that built for YAGARTO
o Which linker scripts to use - there is some variation.
o Which set of start up files to use - each tutorial example has it's own make file and start-up files.

I was able to download and run an example binary using the SAM boot assistant, the program blinks the LEDs, so I know the board is working.  I was able to build an example from Atmel and was also able to download the binary, but the example was written for a different board so nothing actually happens.

I'd like to do some remote debugging with gdb and will be digging into that literature.
Best;
Jonathan

Offline jmhill

  • Single posting newcomer
  • *
  • Posts: 4
Re: Looking into CodeBlocks and CodeSourcery
« Reply #5 on: October 30, 2011, 11:35:28 pm »
Just took a step forward.

I downloaded the at91sam7s-ek package from Atmel.  The package contains example programs for the at91sam7s-ek development board, supporting three different sets of tools, including GNU.  There are some oddities with the package, first off that the "getting started" example is not trivial.  Also, with an adjustment to the Makefile, setting the values assigned to CHIP and BOARD, to what's actually present is sometimes needed.

I just ran and built the basic adc project.  My SAM7-P256 board has a potentiometer and a thermistor, as well as RS232 output.  The Makefile, indicates where to change a statement to a comment, for debugging the project.  The CodeSourcery tools cleanly built the example.

I installed the Segger software.  I saved the recommended init sequence for gdb in a file named .gdbinit and saved that into the project folder.  I was just able to use the Segger J-LINK to download the code to the board and do some debugging.

This is all very good for a number of reasons.  I'm not fully convinced that it's working, but I think that's enough for right now.
Best;
Jonathan

Offline themaddin

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Looking into CodeBlocks and CodeSourcery
« Reply #6 on: February 16, 2012, 12:22:46 pm »
Hello Jonathan,

what do you mean with some debugging? Did it worked? Did you debugged with Codesourcerys GDB?

I have troubles debugging with Codeblocks and Codesourcery GDB.
See: forums.codeblocks.org/index.php/topic,15965.new.html

Kind regards
Martin
« Last Edit: February 16, 2012, 01:49:23 pm by themaddin »