AVR Studio

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
Roy from New Zealand
Posts: 7
Joined: Sat Nov 14, 2009 9:19 am
Contact:

AVR Studio

Post by Roy from New Zealand »

I am new to flowcode, how do you set up an AVR Studio 4 project that uses flowcode as it editor and compiler?

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: AVR Studio

Post by Sean »

Hello Roy,

We haven't tried to run Flowcode as an editor from within AVR Studio. We will look into this possibility.

Flowcode is supplied with its own copy of WinAVR, and the compilation is handled by batch files in the Tools/MX_bats folder of the Flowcode installation - using parameters passed from the Flowcode Chip -> Compiler Options menu. It might be possible to handle larger projects directly from Flowcode by creating project specific batch files.

The creation and use of new batch files has proved to be flexible enough to support alternative compilation sequences, including the integration of FreeRTOS.

Roy from New Zealand
Posts: 7
Joined: Sat Nov 14, 2009 9:19 am
Contact:

Re: AVR Studio

Post by Roy from New Zealand »

Thanks for the response

If I use flowcode to compile a program to C can flowcode also generate the elf file so that I can then use AVR Studio and the AVR DRAGON to step through the C program and debug my program.

As AVR Studio is free and seems to be a good why of testing a program and I already have the AVR dragon I would like to be able to make full use of the AVR Dragon.

As I understand it your programmers do not handle JTAG were as the dragon does.

I already have WinAVR and this is available as an option when I want to start a new AVR studio project.

I will experiment as I may be able to specify that I am using WinAVR but use the flowcode C file as a source file.

I will let you know how I get on.

Regards Roy

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: AVR Studio

Post by Sean »

Hello Roy,

I have attached a modified copy of the avrb.bat file that generates a .elf file in addition to the .hex file.
avrb.zip
(335 Bytes) Downloaded 573 times
This requires the following parameters to be used in the Linker/Assembler section of the Chip -> Compiler Options menu:

"%D\%f.elf" "%D\%f.hex" "%D\%f.cof"

Version 4 of Flowcode for AVR uses this feature to add improved simulation and debugging capabilities.

Our standard AVR programmer is the AVRISPmkII, but the AVRDUDE programming utility supports several other programmers, including the AVR DRAGON - which we have used to program target devices directly from Flowcode. This would only require a minor change to the avrc.bat file.

Huib Koppers
Posts: 63
Joined: Fri Oct 12, 2007 5:13 pm
Location: Netherlands
Been thanked: 1 time
Contact:

Re: AVR Studio

Post by Huib Koppers »

Sean,

Both programs AVR studio 4 SP2 and FlowCode for AVR V4 give no errors when c files where compiled to hex and then programmed by stk500 / AVR Pololu USB ISP-programmer or AVR-Dragon to the chips if next things shall be taken care off;
1.) To get no compilation errors i have placed the missed MX_util in the AVR Studio 4 path;
C:\Program Files (x86)\Atmel\AVR Tools\AvrStudio4\MX_util
2.) Also payed attention to the directory path lenght, if the directory path is to long (where the c source is saved) then errors coming up for both AVR Studio v4.18 SP2 and AVR flowCode V4.

So if those things are taken care of then no problems occure with compilation so far i have tested with my own flowcode c files on STK500, STK501, AVR pololu programmer and AVR-Dragon.
For AVR Pololu USB ISP-programmer and STK500/501 i have used the same settings;

Programmer-settings; STK500 for STK500v2 and AVR Pololu USB ISP-Programmer

Location: C:\Program Files (x86)\Atmel\AVR Tools\STK500\Stk500.exe

Parameters: -d%t -ms -e -pf -vf -if%F.hex

AVR Flowcode V4 and AVR Studio 4 SP2 are installed on Windows 7 64bit

I hope this will help


Kind regards

Huib

pravat
Flowcode V4 User
Posts: 19
Joined: Thu Aug 05, 2010 4:47 am
Contact:

Re: AVR Studio

Post by pravat »

Hi,
I am using AVR STUDIO4 and FLOWCODE4 for AVR. The Flowkit is not working properly during debug session with Timer, especially when interrupt is being generated from two inputs to initialise and stop the timer so I want to test the program after generating the C program from FlowCode4 and then I want to generate and debug in AVR STUDIO. I am not an expert at C. PLEASE TELL ME THE STEPS INVOLVED TO CONFIGURE AVR STUDIO4 SO THAT I CAN RUN FLOWCODE 4 GENERATED C PROGRAM TO SIMULATE AND CONVERT IT TO HEX. I AM AWARE WITH AVRISPMKII AND JTAGICE DEBUGGER AND WINAVR WHICH IS ALREADY INSTALLED WITH AVRSTUDIO 4.
with regards
Pravat :(

pravat
Flowcode V4 User
Posts: 19
Joined: Thu Aug 05, 2010 4:47 am
Contact:

Re: AVR Studio

Post by pravat »

Hi
I found the solution from user forum i.e. THE FOLLOWING STEPS HAVE TO BE FOLLOWED FOR USING A C FILE GENERATED FROM FLOW CODE IN AVR STUDIO
(1) create the project in avr studio and copy the c file generated by flowcode contents by note pad in the c file opened in the project of avr studio.
(2)open the project heading next to file heading in the top row and go to configure
(3) in configure go to include directories and include ...\Flowcode AVR V4\FCD\
(4) AGAIN in configure go to include directories and include ...\Flowcode AVR V4\avr\include
now one can compile the program by build and generate all the files required to debug the program with atmel debuggers.
pravat :)

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: AVR Studio

Post by Sean »

There are also some project and compiler options that are set by Flowcode via the avra.bat and avrb.bat files (in the Tools\MX_bats folder of the Flowcode installation).

These are accesible via the Project options menu and sub menus in AVR Studio

One of the most important is the -funsigned-char option that forces all char/byte variables to be compatible with Flowcode.

The -lm option includes the maths library

Flowcode also selects the -Os (optimise for minimum space) option. This can be changed to see the effect on code size and speed.

Other settings can be found by reading through the Flowcode batch files and the documentation available for the GCC/WinAVR project.

Post Reply