Question - ATMega8515 in Atmel Studio 7

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

Hi all,

 

I have been doing some work on learning to develop in GCC for the Atmel MCU's I have as I have only ever used ASM for these MCU's.

 

I noticed that there is no simulator available when developing a GCC project for the ATMega8515 in Atmel Studio 7, so I did a bit of research here and found that it only worked on the older simulator 1 as it was called, and not simulator 2, and therefore Atmel Studio 6 and 7 cannot simulate that MCU. I found this post from John Samperi about this.

 

https://www.avrfreaks.net/comment/1561051#comment-1561051

 

I fiddled some more and found there is a simulator option for the ATMega8515 but only when using ASM but not C.

 

My question is, when a C project is compiled and then simulated, does Atmel Studio not compile it to a hex file then use that code for the simulation or does it simulate the C code? If it compiles to a hex file, it doesn't make much sense that you cannot simulate in C projects but you can in ASM projects.

 

EDIT: Incorrectly stated compiling to assembler instead of a hex file. Corrected

This topic has a solution.

Wayne

East London
South Africa

 

  • No, I am not an Electronics Engineer, just a 54 year old hobbyist/enthusiast
  • Yes, I am using Proteus to learn more about circuit design and electronics
  • No, I do not own a licensed copy of Proteus, I am evaluating it legitimately
  • No, I do not believe in software or intellectual property piracy or theft
Last Edited: Wed. Feb 3, 2021 - 09:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The way simulation works is that for each of the 350+ AVRs Atmel/Microchip take the VHDL (or is it Verilog?) that defines the micro and put that into a simulation wrapper to make a simulation DLL. At simulation time the load the .text and .data segments from the ELF file into the memory regions simulated by the DLL. Whether a particular chip can be simulated is all down to whether such a simulation DLL exists for it.

 

Sadly it seems 8515 is not covered by:

 Directory of C:\Program Files (x86)\Atmel\Studio\7.0\packs\atmel\ATmega_DFP\1.4.351\simulator\win32

16/03/2020  12:33           270,336 ffwAPI.dll
16/03/2020  12:33         2,023,424 libatmega128.dll
16/03/2020  12:33         1,043,456 libatmega1280.dll
16/03/2020  12:33         2,008,064 libatmega1284p.dll
16/03/2020  12:33         1,995,776 libatmega164p.dll
16/03/2020  12:33         1,050,112 libatmega168p.dll
16/03/2020  12:33         2,057,216 libatmega169p.dll
16/03/2020  12:33           853,504 libatmega16a.dll
16/03/2020  12:33         1,046,528 libatmega256.dll
16/03/2020  12:33         1,996,800 libatmega324p.dll
16/03/2020  12:33         1,979,904 libatmega328p.dll
16/03/2020  12:33         2,092,544 libatmega3290p.dll
16/03/2020  12:33           849,920 libatmega32a.dll
16/03/2020  12:33           883,712 libatmega32hvb.dll
16/03/2020  12:33         1,998,336 libatmega644p.dll
16/03/2020  12:33         2,093,056 libatmega6490p.dll
16/03/2020  12:33         1,016,320 libatmega64a.dll
16/03/2020  12:33           759,296 libatmega8a.dll
16/03/2020  12:33         1,331,200 libatmegaapb.dll
16/03/2020  12:33         1,643,520 libatmegaipb.dll
16/03/2020  12:33         1,638,912 libatmegakpb.dll
16/03/2020  12:33         2,063,360 libattinyxe.dll
16/03/2020  12:33         2,054,656 libattinyxg.dll
16/03/2020  12:33         4,170,631 libcarbon5.dll
16/03/2020  12:33           790,528 libcarbonaux.dll
16/03/2020  12:33           344,064 msvcr70.dll
16/03/2020  12:33           348,160 msvcr71.dll
16/03/2020  12:33            52,174 pthreadGC.dll
16/03/2020  12:33         1,634,304 vtoc.dll
              29 File(s)     42,089,813 bytes

:-(

 

Your best bet is to go to Microchip's archive and get an installer for Studio 4.19 and use that instead.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The Simulator steps through the raw binary values stored in Flash memory.    Obeying the AVR instruction set.    Which is pretty straightforward.

 

When it comes to simulating the AVR peripherals it becomes more complicated.   Ensuring that each SFR bit is set/cleared at the appropriate machine cycle is what you require for accuracy.

 

The current Simulator behaves according to the Silicon hardware design files.

 

Not all of the older AVRs are supported.  I presume that this is because their Silicon used a different design language, format, style, ...

But it may just be that the Microchip Studio team have just not run the software that creates the Simulator data tables from the older Verilog (or whatever) files.

 

I suspect that the Simulator data requires a little massaging i.e. the automation is not 100% perfect.

Otherwise every peripheral on every AVR chip would have been simulated 100% from day one. (that the tool to translate the Verilog was written)

 

Pure speculation.   As always,   I type from my backside.

 

Yes,  it is annoying when you discover that a particular AVR model is not supported by the Simulator.

On the other hand,   any modern AVR comes with OCD.   So you can examine peripherals in real life.

Of course the elderly AT90S8515 and ATmega8515 have never had OCD.

 

In practice,  you can develop on a bigger AVR with more legs (and OCD).  

Then re-build for the mega8515 for final tests.

 

Timers, EEPROM, ADC, External Memory Bus, ... are pretty interchangeable e.g. from 8515 to 128 operation but the SFR addressing is vastly different.

 

David.

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

WayneZA wrote:
I have only ever used ASM for these MCU's.

Have you used 'C' with any other MCUs? Or in any other applications at all?

 

If not, it's probably easier to learn the 'C' language on a PC - away from all that added complications & restrictions of a small embedded microcontroller.

 

Then, once you've got a good grasp of the language, you can move on to applying that to the microcontroller.

 

As David mentioned, modern chips come with On-Chip Debug (OCD) - so you can step your code, view & modify registers, memory, etc on the real hardware.

 

And, nowadays, dev boards complete with a built-in debug adaptor are widely available for around $10 or less; eg,

 

https://www.avrfreaks.net/commen...

 

So there's a lot less call for simulation.

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

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

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

Thank you all for your comprehensive answers. They give me a better understanding of how the simulator works.

 

 

awneil wrote:

Have you used 'C' with any other MCUs? Or in any other applications at all?

 

If not, it's probably easier to learn the 'C' language on a PC - away from all that added complications & restrictions of a small embedded microcontroller.

 

Then, once you've got a good grasp of the language, you can move on to applying that to the microcontroller.

 

I have developed applications in many languages, but unfortunately not C/C++/C#. Your advice is good, thank you for your suggestion. I am using Visual Studio 2019 to learn in C#/C++, and then applying what I am learning to test/learning applications I am writing in Atmel Studio in a GCC project which I then want to simulate. I find looking at other people's code for this is a definite help, as it is with other languages and development in general.

 

I must say though that C is a large departure from any of the other languages I am fluent in, but I'm getting there.

Wayne

East London
South Africa

 

  • No, I am not an Electronics Engineer, just a 54 year old hobbyist/enthusiast
  • Yes, I am using Proteus to learn more about circuit design and electronics
  • No, I do not own a licensed copy of Proteus, I am evaluating it legitimately
  • No, I do not believe in software or intellectual property piracy or theft
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

WayneZA wrote:
I am using Visual Studio 2019 to learn in C#/C++

Visual Studio will also compile "plain" C

 

You will have noticed the similarity between Visual Studio and Atmel Microchip Studio ...

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

awneil wrote:

Visual Studio wll also compile "plain" C

 

Thanks, I did not know that, never having developed in C before.

 

awneil wrote:

You will have noticed the similarity between Visual Studio and Atmel Microchip Studio ...

 

Indeed I have. I believe AS7/MS7 is based on Visual Studio 2015

Wayne

East London
South Africa

 

  • No, I am not an Electronics Engineer, just a 54 year old hobbyist/enthusiast
  • Yes, I am using Proteus to learn more about circuit design and electronics
  • No, I do not own a licensed copy of Proteus, I am evaluating it legitimately
  • No, I do not believe in software or intellectual property piracy or theft