Author Topic: Small ATMEGA Debugging Shell  (Read 2370 times)

0 Members and 1 Guest are viewing this topic.

Offline ray-sanTopic starter

  • Contributor
  • Posts: 14
  • Country: de
Small ATMEGA Debugging Shell
« on: December 14, 2016, 12:23:39 pm »
Hi there,
this is my first post on this forum. I've registred because a friend of mine (Florian Rassl) has developed a little debugging shell for the Atmega Series from Atmel, of which i thought it is rather neat. So i wanted to share the code with you. It's primalary designed for the Atmega328u, which you can find on the Arduino Micro development board, but you should can adapt the code for most of the Atmel chips. He has coded that because he wanted to do something with that, if i remember right, for that RC remotes for remote controlled cars, planes, quadcopters and stuff, and things (as always) didn't work on the first go.

What it provides:
So you code around the "framework", connect a cable from your PC's serial port to the UART, interrupt the running code with a '#+c' key combo (he didn't get the ctrl+c combo working) in your favourite serial terminal application, and you find yourself in a little shellish environment (with tab autocompletion, isn't it nice?!), where you can read out individual pins, put pins high/low, put some (hard) PWM to the pins and read out the ADC. By coding the "framework" he had also expandability in mind, so you can also code your own functions whichever you think that they are useful to you into the shell, and execute them from the debugging console.
If you type in a command with the '-h' argument, you get a small help, which shows which arguments each command expects.

What it doesn't provide:
The shell commands are at the moment fixed to a maximum length of (i think) 80 characters to keep the memory footprint small. (You should can change this behavior, but keep in mind you are running on a uC, not on a PC with almost an infinity ammount of RAM)
The code is not so well commented, all comments are in german language and it lacks of a documentation (Yeah, programmers are lazy people). If you have special questions, i think, i can redirect them to him and (hopefully) answer them back here.
Probably it has some bugs


Licence:

It is distributed under the very restrictive "do whatever you want, don't blame us" licence. If you put the code somewhere and it goes on fire, its your fault, not ours. Just don't do something stupid (unless you know, what you are doing).

If you code some extensions or make cool modifications, please share them with us (of course you don't have to, but it would be nice)
 
The following users thanked this post: bingo600

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 614
Re: Small ATMEGA Debugging Shell
« Reply #1 on: December 16, 2016, 04:38:51 pm »
It's primalary designed for the Atmega328u, which you can find on the Arduino Micro development board
I cannot find the datasheet. Are you sure it is Atmega328u?
 
The arduino micro comes with ATMega32U4. The chip comes with JTAG and what you describe (and much more) can be made with 0 lines of code by just attaching a debugging dongle to it.

Ok, here is the screenshot during interrogation of an older sister, AT90USB128x. When you write in a gdb console "p $sp" it prints stack pointer, if you write "wmw $PORTA 0xff" it sets PORTA pins high, if you write "step" it does one step, etc, is it +- what your software does?
« Last Edit: December 18, 2016, 01:43:59 pm by Brutte »
 

Offline ray-sanTopic starter

  • Contributor
  • Posts: 14
  • Country: de
Re: Small ATMEGA Debugging Shell
« Reply #2 on: February 03, 2017, 05:24:42 pm »
Sorry for the late reply. I'm not sure if it is for the AtMega 328, may it is for the Atmega168, but im definitly sure, it is not for the 32u4, because my mate has none of these boards laying around.
Of course you can do this with a debuger. But most of the Atmegas these days don't come with a JTAG port, but rather with a so called "debug wire", which is a proprietary protocoll, designed from atmel for debugging atmegas (and attinys i think), for which you need a special debugger (you can't do that with your standard avrispmkii/usbasp/other standard flasher), which not everybody has laying arround.
 

Offline ray-sanTopic starter

  • Contributor
  • Posts: 14
  • Country: de
Re: Small ATMEGA Debugging Shell
« Reply #3 on: February 03, 2017, 05:33:09 pm »
Here comes another updated version, with cleaned up code and updated comments. Every term of the first post apply also to this.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->