Horrible bugs in AVR8_Examples>Port_Blink project


Recommended Posts

the project might work fine as it is, but anyone who tries to write bigger programs based on that project is in for a world of shit

that was the case for me atleast

bug/feature 1) there is -nostartfiles flag in the makefile, meaning compiler will not write the interrupt table, on one hand it results in smaller code, on the other.....

there is never a call for function main(), sure its fine if main is the only function there is, it just runs through the c setup loops and ends up in the first function in the machine code,

problem is, if you add functions, main() in not nessecerily the first function in machine code...... in fact avr-gcc seems to put the main() as the last function

the flag should be cleared

bug 2) there is -Line_Length 100000000 flag for srec_cat, for generating the .mem file, what it should do is write the entire code in one line as long as its shorter than 100000000 bytes, in fact srec_cat defaults to 255 byte lines if the -Line_Length parameter is bigger than 255, so that results in odd number of bytes per line, last instruction on line 0 is cut in half, first byte on line0 second byte on line1, now data2mem reads 2 bytes at a time when generating prog_mem_init.vhd, and the last byte on line0 in .mem file just goes missing, and thus all instructions after 0xfe are garbage, -Line_Length should be set to something reasonable eg 80, it works fine then

took me quite some time to figure these bugs out, but as an end result i managed to port avr8 to Xiling spartan3e1600e and run it on my dev board and control character lcd with it

http://www.digilenti...93&Prod=S3E1600

http://no.life.ee/ra...n_xc3s1600e.jpg

Link to comment
Share on other sites

Hello r2k,

Can you point me to where you downloaded the code you are working with from? I don't remember ever releasing an actual Makefile based version of AVR8. I remember hacking one together in the beginning to get everything to work. But I never cleaned it up for a release, if it's out there somewhere I need to take a look and clean it up or something.

Thanks,

Jack.

Link to comment
Share on other sites

well, i found it here

http://gadgetforge.gadgetfactory.net/gf/project/avr_core/frs/?action=FrsReleaseBrowse&frs_package_id=7

theres a port_blink project in that archive, seems like you are the author of the main.c but there is no mention of your name in the makefile where the bugs are, nevertheless, i hope it gets fixed, i wouldnt want anyone else spending days digging trough machine code and processor intestines to find these bugs(tho it was educational)

on a good note after i got these bugs sorted out things started going real smooth, i got a rotary encoder input working and attached to the avr8 and even managed to write an spi interface for it and control ADF4350(RF frequency syntesizer 137.5 - 4400MHz) eval board with avr8, little more and i have a sine signal generator with lcd that i can tune from a rotary knob

http://uk.farnell.com/analog-devices/eval-adf4350eb1z/board-eval-for-adf4350/dp/1984805

Link to comment
Share on other sites

Ok,

That explains it, that is very old, released in 2009. That was my very first work at getting the AVR8 working, I then moved on to making everything work under the Arduino IDE. There were indeed some serious bugs with the output created by srec-cat not being read correctly by the data2mem tool from what I remember. It took me a long time to figure out what was going wrong there...

I think someone put together a much nicer Makefile in the code playground.

The gadgetforge.gadgetfactory.net site is only there for archiving purposes. There hasn't been any active development there for two years... Maybe it's time to shut it down.

Jack.

Link to comment
Share on other sites

well i think working example should be available somewhere, imho arduino software platform just isnt viable for much more than blinking leds, but if you can write c straight to soft processor on fpga.. thats useful. most soft processors out there would need you to write your own memories and periherals, and sometimes only way to write code for them is assembler. in that regard avr8 is a great way to implement all sorts of procedural problems on fpga that are not very speed sensitive, eg user interfaces etc that would require unreasonable complexity without a soft processor

next thing on my tasklist is to try and get UDP running on my board, will see how that goes

Link to comment
Share on other sites

We looked closer at the stuff we have on gadgetforge.gadgetfactory.net and there is a lot of good information there. So we are going to leave the site up for now and work on a big red banner that warns that the site is outdated.

If you get UDP running definitely let us know, would be very interested in that.

Thanks,

Jack.

Link to comment
Share on other sites

Archived

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