Unit Test with Atmel Studio 7 Simulator

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it possible to integrate the built-in AVR Simulator with a test automation framework?

 

https://www.avrfreaks.net/forum/...

 

I am new to the platform and so far it appears to be intended for the Visual Studio-based IDE. I am unaware of the backend.

 

Cheers,

Joe

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

beowulf34 wrote:
Is it possible to integrate the built-in AVR Simulator with a test automation framework?

 

What do you have in mind?

 

beowulf34 wrote:
so far it appears to be intended for the Visual Studio-based IDE.

 

Correct

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

beowulf34 wrote:
Is it possible to integrate the built-in AVR Simulator with a test automation framework?

 

What do you have in mind?

 

JIm

 

Automated unit tests which output the state transitions given input stimuli scenarios.

 

I want to refactor legacy code into a Moore state machine, with the outputs defined by the state. I need a comparative way to show that the output are equivalent in the ways we care about with the legacy code.

 

I also want to wrap that into automated software based regression tests as part of the CI/CD pipeline. Core functionality of the external behavior needs to be guaranteed before the software is considered for Release and further validation testing.

 

Cheers,

Joe

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

beowulf34 wrote:
... and so far it appears to be intended for the Visual Studio-based IDE.
... and Visual Studio Code

beowulf34 wrote:
I am unaware of the backend.
atbackend.exe has an AVR GDB proxy that's complete in Microchip Studio.

Some operators prefer an AVR to a simulated AVR.

 


GitHub - avrsimulator/gdbproxy

GitHub - xoriath/vscode-atmel-debug: Debug adapter for Visual Studio code for the Atmel debug backend

AVR Studio On Mac & Linux? | AVR Freaks

 

Microchip Studio 7.0.2542 | AVR Freaks

How do you debug avr code on non-windows platforms (Free Pascal)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My situation is a little more nuanced. The legacy code has 4 threads (4 timer ISRs) with interdependence. It would be a more appropriate of a test to have the simulator or actual hardware execute and output the results.

 

The AVR Simulator would be a useful abstraction to allow for more developers to work on it concurrently without hardware and debuggers and instrumentation.

 

This is somewhat related: https://www.avrfreaks.net/forum/...

  1. https://github.com/buserror/simavr

  2. https://github.com/avrsimulator/gdbproxy

 

simavr appears to be slightly neglected and failing to reproduce the Hello World.

 

The reference to gdbproxy does not make sense to me yet. I do not see how it helps unless it connects GDB to the AVR Simulator, which could then be scripted to produce STDIO outputs.

 

Cheers,

Joe

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why not buy an Atmel ICE and hardware debug with a few watch windows.  Certainly would be easier.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

beowulf34 wrote:
simavr appears to be slightly neglected and failing to reproduce the Hello World.
AVR QEMU should do that though not much more (limited I/O)

QEMU AVR | AVR Freaks

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

Why not buy an Atmel ICE and hardware debug with a few watch windows.  Certainly would be easier.

 

JIm

 

Tell me more.

 

We have the Atmel ICE. I would love to use it like I do the SEGGER J-LINK to run hardware functionality tests via RTT (high speed printf and scanf) and the SWD/JTAG interface. A command line runner of a test binary to capture serial output.

 

Cheers,

Joe

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

beowulf34 wrote:
Tell me more.

 

Simple,

Connect it to the debug interface of your AVR, then set up studio to debug using the ICE, load up teh watch window with the registers and/or variables you want to observe, place breakpoints as needed and run teh program

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

beowulf34 wrote:
SEGGER J-LINK to run hardware functionality tests via RTT

RTT is a proprietary Segger thing - so won't work with Atmel-ICE.

 

https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/

 

You might be able to use Live Watch: http://atmel-studio-doc.s3-websi...

 

Maybe also the Data Gateway Interface (DGI): 

 

http://ww1.microchip.com/downloads/en/devicedoc/atmel-32223-data-gateway-interface_userguide.pdf

 

https://microchipdeveloper.com/atmelice:connecting-atmel-ice-to-data-gateway-interface

 

https://www.microchip.com/content/dam/mchp/documents/data-visualizer/40001903B.pdf

 

EDIT

 

Add RTT link - for the benefit of those that hadn't heard of it.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. May 4, 2021 - 07:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

beowulf34 wrote:

I want to refactor legacy code into a Moore state machine, with the outputs defined by the state.

...

...

I also want to wrap that into automated software based regression tests as part of the CI/CD pipeline.

 

I might try getting the legacy code running in an PC based Environment / IDE (Visual Studio / Eclipse etc). Running tests becomes trivially easy (and very fast compared to programming a real AVR)

Create a thread to run your AVR code

Create a further 4 threads to simulate your ISRs.

 

It could take you a few days to port it over but I think the effort does pay back for complex projects, especially if you keep the PC port maintained..

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:
try getting the legacy code running in an PC based Environment

+1

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...