Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
mclayton
PostPosted: Sep 03, 2007 - 08:24 PM
Rookie


Joined: Jun 26, 2004
Posts: 29


Got my EVK-1100 a couple of days ago, and I'm trying to get it set up with AVR32 Studio on a PC. Had some trouble getting it set up, but here are some "take-aways:

- The version of AVR32 Studio on the CDROM that came with the EVK-1100 was already superseded by what's on atmel.com, so use the latter instead.

- Before you install the software, remove any prior installations of Cygwin.

- After you install the toolchain, make sure that you REPLACE the 3.81 version of make.exe with 3.80 (just Google for the correct file - there's a known defect with 3.81). If you don't know which you have, just type "make --version" at the command line.

- I was getting Error 127 when I tried to build anything. Another post mentioned that the cygwin entries in the system path should be moved up closer to the front. But all I had to do was shorten my path by removing a few obsolete paths (not related to AVR stuff) and the errors went away. Apparently, there's something in the toolchain that can't handle a long path.

- To use the USB bootloader, install the Flip program from Atmel, but don't bother with the GUI program - it doesn't yet support AVR32. If you use the latest version of AVR Studio, you can set up an AVR32 target using the BatchISP boot loader, but (as the README warns), it won't work (yet).

- The "batchisp" command-line tool seems to work well bootloading new code to the EVK-1100 via USB. To get the EVK-1100 into ISP mode, just hold down the joystick button while releasing the reset button. If the LCD then goes blank (and backlight goes off), you have a bootloader installed and your PC should indicate that a new USB device has been detected (XP calls it an "Atmel DFU").

-After building the HelloWorld program in AVR32 Studio, I entered the following command line:
batchisp -device at32uc3a0512 -hardware usb -operation erase f loadbuffer HelloWorld.elf program verify start reset 0

This erases the factory-installed control panel program, but unfortunately, the "Hello World" program doesn't appear to be running as it should. Further tests show that the downloaded program does not appear to be running at all, but without the JTAGICE mkII, I can't see what's going on. The good news is that it doesn't break the bootloader, so I'm able to keep trying using USB only.

I'll be getting the JTAGICE mkII soon, but for now I'm at a dead end. Has anyone gotten further than this with the USB bootloader? Looks to be *almost* there!

thanks,
-Mark


Last edited by mclayton on Sep 05, 2007 - 06:49 AM; edited 2 times in total
 
 View user's profile Send private message  
Reply with quote Back to top
mclayton
PostPosted: Sep 04, 2007 - 03:25 AM
Rookie


Joined: Jun 26, 2004
Posts: 29


I can now build the control panel application in AVR32 Studio, and use the ISP bootloader through the USB port to load it. The solution may not be the best way to solve the problem, but it seems to work.

Even the Atmel documentation for Batchisp, shows a warning that the user program and the bootloader overlap. This makes sense, since they both start at the beginning of the flash at 0x80000000. But it's in their examples, so it must be OK, right? I don't think so. I changed the linker scripts to set the start of the flash to 0x8002000, and now the builds show the user program code starting at that address.

Now when it's downloaded via batchisp from the command line, it loads without the overlap warning, AND IT WORKS.

I've now tried building the poorly named "QuickStart" HelloWorld program, but so far that's a giant mess of missing header files and such. But at least I've been able to verify that it's possible to use AVR32 Studio along with batchisp from the command line to load arbitrary code into the EVK1100 via the USB boot loader. The JTAGICE mkII is not needed for that.

-Mark
 
 View user's profile Send private message  
Reply with quote Back to top
KaiBen
PostPosted: Sep 04, 2007 - 11:17 AM
Wannabe


Joined: Jul 27, 2007
Posts: 58


Hi Mark,

You don't have to hack your linker scripts to use the bootloader. Read the chapter 7.5.3.1 of the bootloader datasheet:
http://www.atmel.com/dyn/resources/prod_documents/doc7745.pdf

What you have to do is:
- Add SERVICES/USB/CLASS/DFU/EXAMPLES/ISP/BOOT/trampoline.S to your project. Because of an issue in AVR32 Studio, this will require to rename trampoline.S to trampoline.s before adding it to your project files. Then change the build properties of this file to use avr32-gcc instead of avr32-as and use the option `-x assembler-with-cpp' (without quotes).
- Use the linker script UTILS/LINKER_SCRIPTS/AT32UC3A/0512/GCC/link_uc3a0512.lds thanks to the `-T' link option (without quotes).
- Add the link option `-Wl,-e,_trampoline' (without quotes) to your build properties.

For your missing header files, you have to extract UTILS/AVR32_HEADER_FILES/GCC/AVR32_Header_Files_for_AVR32-GCC.zip from the UC3 software framework to /usr/local/avr32/include/avr32/.

++
Ben
 
 View user's profile Send private message  
Reply with quote Back to top
sma
PostPosted: Sep 04, 2007 - 08:13 PM
Posting Freak


Joined: Jan 14, 2007
Posts: 1836
Location: Nantes, France

BTW all the Makefile in the software framework already include the trampoline.S that makes your program links in 0x80002000 and works standalone and with the bootloader. So unless you are using Managed Makefile from avr32Studio, you may want to prefer using your own makefile based on the ones from the framework.

I think the bootloader user guide gives a quite good explanation on this overlap section (trampoline that makes your program linked at {reset vector (0x80000000)+trampoline jump (0x2000)}=0x80002000.

Note this makefile has a goal that can use the Batchisp. I have added in AVR32Studio a make target named "isp program" (that called a "make isp program") and it will call batchisp with the correct command line.

-sma
 
 View user's profile Send private message  
Reply with quote Back to top
mclayton
PostPosted: Sep 04, 2007 - 11:16 PM
Rookie


Joined: Jun 26, 2004
Posts: 29


Thanks for the helpful info. I'm struggling now with trying to understand how avr32Studio works, and it's not helped by the "quick start" examples, which set you up with Managed Makefiles that aren't able to make the project. I'm used to working on makefiles and multiple project management, but avrStudio (i.e. Eclipse) adds a lot of layers of abstraction that I don't need or (yet) understand. I've yet to find a good tutorial on how Eclipse works for non-Java development, and unfortunately, the AVR tutorials don't help too much.

I had already read about the trampoline section, but it was unclear to me what was responsible for what. My hack worked because the start address in the elf file is irrelevant, and the bootloader automatically jumps to 80020000 to start executing the user program. And actually, it was easier to change the flash start address in the user/local/avr32/lib/ldscripts/avr32ekf_uc3a0512.* files from 0x80000000 to 0x80020000. I found that the FLASH value in the makefile doesn't seem to do much. I changed it and it did nothing, then I deleted it and it still seemed to make no difference.

Thanks again for the pointers.

-Mark
 
 View user's profile Send private message  
Reply with quote Back to top
mclayton
PostPosted: Sep 05, 2007 - 06:48 AM
Rookie


Joined: Jun 26, 2004
Posts: 29


Here's an update with mylatest progress, which may hopefully help others get up and running more quickly.

I first updated the AVRDevelopmentTools to beta version 1.0.4.

One remaining problem was that I couldn't get AVR32Studio to recognize the application framework, regardless of the base directory for the workspace. The solution was to open a new Standard (NOT Managed) Make C AVR32 project (I called it "Framework"), and then import from the file system. But this time, just go to the top of your framework installation files and check the directory. Even though no files are shown to import, it will import everything and you'll then have the complete tree with projects for APPLICATIONS, BOARDS, COMPONENTS, DRIVERS, SERVICES and UTILs. With the earlier software, this was created automatically, but now this one manual step seems to do the job.

I'm very happy to report that the new version already has all of the trampoline code in place in order to work properly with the boot loader. All of the patches mentioned above are already in place, and the project built with no errors on the first attempt. Congrats to Atmel for that.

As for ISP programming through the USB, that also works using the newly-available "isp" target in makefile, so all I needed to do was to create a Make Target of "program isp run", and it works perfectly. Leave out the "isp" and it should then switch to the JTAGICE mkII. I'll mark this thread as solved, but if I run into any more installation tips or tweaks, I'll post them here. Thanks for the help, folks.
 
 View user's profile Send private message  
Reply with quote Back to top
sma
PostPosted: Sep 05, 2007 - 10:13 AM
Posting Freak


Joined: Jan 14, 2007
Posts: 1836
Location: Nantes, France

hehe, you would have wanted to read this before
http://www.avrfreaks.net/index.php?name ... mp;t=53341
 
 View user's profile Send private message  
Reply with quote Back to top
mclayton
PostPosted: Sep 05, 2007 - 08:37 PM
Rookie


Joined: Jun 26, 2004
Posts: 29


Ha! I guess great minds think alike, but the greater mind thinks of it first.

It would sure help if all this great info was available in one place. Time to start coding!

-Mark
 
 View user's profile Send private message  
Reply with quote Back to top
sma
PostPosted: Sep 07, 2007 - 10:18 AM
Posting Freak


Joined: Jan 14, 2007
Posts: 1836
Location: Nantes, France

Quote:

but the greater mind thinks of it first.


Wink
 
 View user's profile Send private message  
Reply with quote Back to top
mitchcortinueviz
PostPosted: Oct 25, 2007 - 05:03 PM
Newbie


Joined: Oct 24, 2007
Posts: 10


Quote:
I changed the linker scripts to set the start of the flash to 0x8002000, and now the builds show the user program code starting at that address.
I have similar problems, where are these scripts to modify?
thanks
 
 View user's profile Send private message  
Reply with quote Back to top
KaiBen
PostPosted: Oct 25, 2007 - 06:54 PM
Wannabe


Joined: Jul 27, 2007
Posts: 58


Everything is explained in my post and sma's. Wink

/usr/local/avr32/lib/ldscripts/avr32elf_uc3a0512.x

UTILS/LINKER_SCRIPTS/AT32UC3A/0512/GCC/link_uc3a0512.lds

If you have more specific questions, just ask.

++
Ben
 
 View user's profile Send private message  
Reply with quote Back to top
iodz83
PostPosted: Oct 25, 2007 - 08:21 PM
Rookie


Joined: Oct 08, 2007
Posts: 38


KaiBen wrote:
Everything is explained in my post and sma's. Wink

/usr/local/avr32/lib/ldscripts/avr32elf_uc3a0512.x

UTILS/LINKER_SCRIPTS/AT32UC3A/0512/GCC/link_uc3a0512.lds

If you have more specific questions, just ask.

++
Ben

Thank's, I've modified these script and my it worked! I wanted to try in this cleaner way:
Quote:
What you have to do is:
- Add SERVICES/USB/CLASS/DFU/EXAMPLES/ISP/BOOT/trampoline.S to your project. Because of an issue in AVR32 Studio, this will require to rename trampoline.S to trampoline.s before adding it to your project files. Then change the build properties of this file to use avr32-gcc instead of avr32-as and use the option `-x assembler-with-cpp' (without quotes).
- Use the linker script UTILS/LINKER_SCRIPTS/AT32UC3A/0512/GCC/link_uc3a0512.lds thanks to the `-T' link option (without quotes).
- Add the link option `-Wl,-e,_trampoline' (without quotes) to your build properties.

But I can't modify options of avr32-as because they are grey (read only)
 
 View user's profile Send private message  
Reply with quote Back to top
KaiBen
PostPosted: Oct 25, 2007 - 10:33 PM
Wannabe


Joined: Jul 27, 2007
Posts: 58


iodz83 wrote:
But I can't modify options of avr32-as because they are grey (read only)


Which version of AVR32 Studio do you use?

You could as well rename trampoline.S to trampoline.c before adding it to your project files. Then change the build properties of this file to use the avr32-gcc option `-x assembler-with-cpp' (without quotes).

++
Ben
 
 View user's profile Send private message  
Reply with quote Back to top
iodz83
PostPosted: Oct 29, 2007 - 08:33 PM
Rookie


Joined: Oct 08, 2007
Posts: 38


Ok, it worked. I tryed to modify options directly and not in the other tabs. That's why I couldn't change options. Now, thanks to you and to atmel support, I solved my problem.
thanks again!
 
 View user's profile Send private message  
Reply with quote Back to top
KaiBen
PostPosted: Oct 29, 2007 - 08:37 PM
Wannabe


Joined: Jul 27, 2007
Posts: 58


Glad to help.

++
Ben
 
 View user's profile Send private message  
Reply with quote Back to top
Zippi
PostPosted: Nov 09, 2007 - 11:20 PM
Rookie


Joined: Mar 12, 2007
Posts: 24
Location: Germany

OK i have the Problem too.

Where can i modify the linker_script?

And what have to changed?
PROVIDE (__executable_start = 0x80000000); . = 0x80000000;
.interp

???
Please Help.
 
 View user's profile Send private message  
Reply with quote Back to top
KaiBen
PostPosted: Nov 10, 2007 - 01:00 AM
Wannabe


Joined: Jul 27, 2007
Posts: 58


Hi Zippi,

You just have to follow what I said in the 3rd post of this thread.

Or you can replace all occurrences of 0x80000000 with 0x80002000 in the linker script.

++
Ben
 
 View user's profile Send private message  
Reply with quote Back to top
sma
PostPosted: Nov 10, 2007 - 08:30 PM
Posting Freak


Joined: Jan 14, 2007
Posts: 1836
Location: Nantes, France

The framework gcc linker script is located here:
\AT32UC3A-1.1.0\UTILS\LINKER_SCRIPTS\AT32UC3A\0512\GCC

This solution will only work if you load with the USB botloader.

If you need to load with the jtagicmkII, you'll need to erase the whole flash (including the bootloader) and have some trampoline code at the reset vector:
[/quote]
- Add SERVICES/USB/CLASS/DFU/EXAMPLES/ISP/BOOT/trampoline.S to your project. Because of an issue in AVR32 Studio, this will require to rename trampoline.S to trampoline.s before adding it to your project files. Then change the build properties of this file to use avr32-gcc instead of avr32-as and use the option `-x assembler-with-cpp' (without quotes).
- Use the linker script UTILS/LINKER_SCRIPTS/AT32UC3A/0512/GCC/link_uc3a0512.lds thanks to the `-T' link option (without quotes).
- Add the link option `-Wl,-e,_trampoline' (without quotes) to your build properties.[/quote]

-sma
 
 View user's profile Send private message  
Reply with quote Back to top
Zippi
PostPosted: Nov 10, 2007 - 08:31 PM
Rookie


Joined: Mar 12, 2007
Posts: 24
Location: Germany

Thanks Ben and sma now it Works.

Can someone write a turtorial with pics for other user.
 
 View user's profile Send private message  
Reply with quote Back to top
sma
PostPosted: Nov 11, 2007 - 11:19 AM
Posting Freak


Joined: Jan 14, 2007
Posts: 1836
Location: Nantes, France

You want to try? Wink
 
 View user's profile Send private message  
Reply with quote Back to top
darthvader
PostPosted: Nov 20, 2007 - 09:53 PM
Resident


Joined: Jul 18, 2005
Posts: 803


Quote:

- After you install the toolchain, make sure that you REPLACE the 3.81 version of make.exe with 3.80 (just Google for the correct file - there's a known defect with 3.81). If you don't know which you have, just type "make --version" at the command line.


What's problem with 3.8.1? where can I find 3.8.0?
 
 View user's profile Send private message  
Reply with quote Back to top
squidgit
PostPosted: Nov 21, 2007 - 05:43 AM
Raving lunatic


Joined: Sep 14, 2003
Posts: 4228
Location: Queanbeyan, Australia

IIRC there's a bug in the pattern parsing, you'll occasionally see "pattern contains no %" errors and similar. If you're using cygwin you can run setup.exe and click the version number next to make until it gets to 3.80.[cygwinspoodge]. I think all versions of make shipped with the leading Linux distros are fine so if you're using one of those just update to the latest.

In fact I can't remember whether Linux hosts suffered from this problem anyway, it may have just been cygwin.

-S.
 
 View user's profile Send private message  
Reply with quote Back to top
darthvader
PostPosted: Nov 21, 2007 - 08:39 AM
Resident


Joined: Jul 18, 2005
Posts: 803


ok, thanks
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits