Few Questions about AVR8 Running on Papilio One


Guest boseji

Recommended Posts

Hello,

First of all I thank Jack for sending me the Papilio One 250K board.

This is my first FPGA board, and it gets me excited.

I have tried out the Papilio One Special Version Arduino IDE http://gadgetforge.gadgetfactory.net/gf/project/wiringide/frs/

and it works as if I am using a conventional Arduino.

Specially there are two variants "The FPGA One" for Directly JTAG to FPGA and

"FPGA (burn)" which writes the code to the SPI Flash.

However to make AVR development feasible we need to know some details of the Softcore Implementation details of the AVR8 in the FPGA. Here is a list of things that might be helpful to know:

1. Flash (Altough RAM emulated Flash)

2. RAM (Internal SRAM for the Micro)

3. Which AVR Device does the AVR8 implementation come close to

4. Timers (If Available by default - Timer0 & Timer1)

5. UART (If Available UART0)

6. PORT Access Register and PORT functions available by default AVR8 core

Also I wish to know the process in which the Arduino IDE generates .bit files to be loaded into the FPGA.

Then we can keep copies of this executable .bit file and Flash it to as many units as we need.

Kindly clarify on these lines the details for the AVR8 core.

Warm Regards,

Boseji

http://m8051.blogspot.com

Link to comment
Share on other sites

These are excellent questions, thank you for taking the time to ask them.

First of all, there is a lot of information on the Project pages for the Papilio Arduino IDE and the AVR8. Mostly the AVR8 page has a lot of the answers you are looking for.

The AVR8 processor that is used is compatible with the Atmega103 processor. The author of the core, Ruslan, has sent me another core that is compatible with the Atmega168 but I have not had the time to implement it. If anyone is interested in taking a crack at it I can make it available.

There is an alternative to the AVR8 that will be available soon, it is called the ZPUino and Alvaro has been working on it. It uses the 32bit Zylin ZPU processor and can run at speeds up to 100Mhz! Alvaro has made it compatible with the Arduino IDE and it all runs on the Papilio One. This should be released very soon.

1. Flash (Altough RAM emulated Flash)

There is 16kB of space for program code to run in. The Arduino IDE enforces this limit. There is actually BRAM free on the Spartan chip that this can be made larger with. The ZPUino will offer much more space because it gets its program code from the SPI Flash instead of internal memory.

2. RAM (Internal SRAM for the Micro)

4kB of SRAM is available.

3. Which AVR Device does the AVR8 implementation come close to

The Atmega103, if you have any questions it is usually safe to refer to the Atmega103 datasheet.

4. Timers (If Available by default - Timer0 & Timer1)

All of the Atmega103 timers are implemented and available. As an added bonus the timers can be moved to any physical pin that they are needed at. Take a look at the example sketches to see how to do this.

5. UART (If Available UART0)

1 UART is included, the same as with the Atmega103. It is pretty easy to add more UARTs in the VHDL code if that is desired.

6. PORT Access Register and PORT functions available by default AVR8 core

The AVR8 project page shows how the PORT's are connected.

ButterflyOne_AVR8_Ports.jpg

On a side note, in the Atmega103 PORTF is input only. In the AVR8 VHDL source code I hijacked the register space for the Analog functionality to make PORTF bidirectional. This should be transparent to end users but is an interesting note.

The Arduino IDE has been modified to support the use of Makefiles. The process goes like this:

[list type=decimal]

[*]User presses "Compile"

[*]The normal Arduino compile process occurs, avr-gcc converts the source code into a hex file.

[*]The custom Gadget Factory Makefile is called.

[*]The hex file is converted into a mem file.

[*]This mem file is merged into the pre-existing AVR8 bitstream. The pre-existing AVR8 bitstream contains the AVR8 design with empty BRAM space where the code belongs. The hex file which contains the compiled code is merged into the BRAM space of the AVR8 bitstream.

[*]The merged bitstream contains the desired code and the AVR8 soft processor. This bitstream is loaded to the Papilio One over the JTAG port. This can be loaded directly to the FPGA or to the SPI flash.

If it is desired to access and save the merged bitstream then hold down the left shift key while you are pressing the "Compile" icon in the Arduino IDE. This will output verbose information at the bottom and the temporary directory will be visible. Navigate to the temporary directory and find the out.bit file. This is the merged bitstream.

Jack.

Link to comment
Share on other sites

Hello,

Thanks for explaining in details.

I have looked into the AVR8 Core project.

Found there might be a need to upgrade only the speed & Flash.

Also I checked out the ZPUino its quite a punch, but possibly to stabilize it might take time.

I wish if we can boost the speed of the AVR8 core to 16MHz or so

and also increase the BRAM for FLASH size to at least 64K then a basic port of FreeRTOS/GUI Terminal  can be run.

Let me know the basic steps involved in setting up this modification.

Warm Regards,

Boseji

http://m8051.blogspot.com

Link to comment
Share on other sites

Hello,

Even a 16MHz is relieving to know.

Now the only question remains is how can I make my separate program with a makefile.

Then combine the .bit file and flash.

I mean the entire process thats done in the Arduino IDE through a makefile outside it.

As FreeRTOS port cant be used in the Arduino IDE and we need multiple files to be compiled at once to get the Hex.

Running an OS is essential to demonstrate the Power of the SoftCore.

Possibly I can build a small terminal program around the OS making it an interactive simulation with multiple tasks running simultaneously.

But first need to make it possible out side the Arduino IDE constrains.

Kindly suggest me the way to do this.

Warm Regards,

Boseji

http://m8051.blogspot.com

Link to comment
Share on other sites

It should be possible to use the Makefile included in the Papilio Arduino IDE standalone. Look under hardware\tools\butterfly_platform for the Makefile.

Also, if you look at the AVR8 source there are examples of running standalone projects. They use a Makefile as well and don't require any IDE. I think those examples are old examples but they should still work.

Jack.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.