Newbie: creating and compiling a project

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

Hi, I'm a total newbie to AVR and to IDE and programming. I have to make an avr board for my graduate project.
So I need help in creating and compiling a new source code in avr32 studio.
I'm going to write a new code using libraries from the framework.
I've added the framework using the proceedure explained here: https://www.avrfreaks.net/index.p... Should I use Standard or a managed make project? What are the differences between them?
And could you tell me how create a makefile? What files I have to include? I've seen the example showed in AVR32 Studio online help, but it is not clear to me what I have to do.
Keep in mind that I have only basic knowledge of C preogramming (I've used Borland C compilator in a course of basic computer programming).
Thanks
iodz

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

Use managed make, then you won't have to worry about how to create a make file.

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

Ok thanks. I've another question. I'm using an evaluation board EVK1100. When I create a project importing any library from the framework (es gpio.h), there are internal includes not respected (es preprocessor.h, compiler.h, evk1100.h). How can I do this? Is there any way to give a predefined path for all includes?

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

Quote:
Is there any way to give a predefined path for all includes?

Since the header files of the Framework are not just in one place(e.g. evk1100.h is under BOARDS/EVK1100/, while preprocessor.h is under UTILS/PREPROCESSOR/), then you have to specify the path to reach each of these header files your application is using.
cbo.
.

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

Do I have to do it for all files? The problem is that inside every included files there are other includes. It seems strange for me to have to modify the framework files everytime I use them...isn't it? Is there another more direct way for doing it?

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

Could anybody explain me step by step how to create and build a new project?
For example, using EVK1100, I want try to build one of the examples contained in the framework.
Take "/DRIVERS/GPIO/EXAMPLE/gpio_example.c" as our example.
First of all I want make you know that I've successfully programmed and ran this example by directly flashing the precompiled file /DRIVERS/GPIO/EXAMPLE/AT32UC3A/GCC/uc3a0512-gpio_example.elf.
Now I want try to build the gpio_example by myself.
So I follow this steps:
1)File=>New=>"Managed Make AVR32 C project" name=mygpio target mcu=uc3a0512 and project type=AVR32 Executable
2) File=>New=>Other=>File name=mygpio.c
3) Paste gpio_example.c code into mygpio.c
4) File=>Import=>General=>File System and select the 3 included files "compiler.h" "gpio.h" "board.h" "preprocessor.h" "stringz.h" "tpaste.h" "mrepeat.h" "EVK1100.h" and "gpio.c"
5) Project=>Properties=>C/C++ Build=>Tool Settings=>AVR32/GNU C Compiler=>Symbols=>Defined Symbols Add => BOARD=EVK1100
6) Project=>Build Project

The build can't be completed and the console log is this:

Quote:
**** Build of configuration Debug for project mygpio ****

make -k all
Building file: ../gpio.c
Invoking: AVR32/GNU C Compiler
avr32-gcc -DBOARD=EVK1100 -g3 -c -fmessage-length=0 -Wall -O0 -mpart=uc3a0512 -MMD -MP -MF"gpio.d" -MT"gpio.d" -o"gpio.o" "../gpio.c"
Finished building: ../gpio.c

Building file: ../mygpio.c
Invoking: AVR32/GNU C Compiler
avr32-gcc -DBOARD=EVK1100 -g3 -c -fmessage-length=0 -Wall -O0 -mpart=uc3a0512 -MMD -MP -MF"mygpio.d" -MT"mygpio.d" -o"mygpio.o" "../mygpio.c"
In file included from ../board.h:67,
from ../mygpio.c:3:
../EVK1100/evk1100.h:51:22: error: compiler.h: No such file or directory
make: *** [mygpio.o] Error 1
Building file: ../EVK1100/led.c
Invoking: AVR32/GNU C Compiler
avr32-gcc -DBOARD=EVK1100 -g3 -c -fmessage-length=0 -Wall -O0 -mpart=uc3a0512 -MMD -MP -MF"EVK1100/led.d" -MT"EVK1100/led.d" -o"EVK1100/led.o" "../EVK1100/led.c"
../EVK1100/led.c:49:26: error: preprocessor.h: No such file or directory
../EVK1100/led.c:50:22: error: compiler.h: No such file or directory
In file included from ../EVK1100/evk1100.h:54,
from ../EVK1100/led.c:51:
../EVK1100/led.h:74: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Read_Display'
../EVK1100/led.h:82: error: expected ')' before 'leds'
../EVK1100/led.h:92: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Read_Display_Mask'
../EVK1100/led.h:102: error: expected ')' before 'mask'
../EVK1100/led.h:113: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Test'
../EVK1100/led.h:121: error: expected ')' before 'leds'
../EVK1100/led.h:129: error: expected ')' before 'leds'
../EVK1100/led.h:137: error: expected ')' before 'leds'
../EVK1100/led.h:149: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Read_Display_Field'
../EVK1100/led.h:159: error: expected ')' before 'field'
../EVK1100/led.h:173: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Get_Intensity'
../EVK1100/led.h:185: error: expected ')' before 'leds'
../EVK1100/led.c:60: error: expected specifier-qualifier-list before 'U32'
../EVK1100/led.c:65: error: expected specifier-qualifier-list before 'S32'
../EVK1100/led.c:79: warning: implicit declaration of function 'MREPEAT'
../EVK1100/led.c:79: error: 'INSERT_LED_DESCRIPTOR' undeclared here (not in a function)
../EVK1100/led.c:79: error: expected expression before ')' token
../EVK1100/led.c:81: warning: missing braces around initializer
../EVK1100/led.c:81: warning: (near initialization for 'LED_DESCRIPTOR[0]')
../EVK1100/led.c:81: warning: excess elements in struct initializer
../EVK1100/led.c:81: warning: (near initialization for 'LED_DESCRIPTOR[0].GPIO')
../EVK1100/led.c:88: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Read_Display'
../EVK1100/led.c:94: error: expected ')' before 'leds'
../EVK1100/led.c:121: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Read_Display_Mask'
../EVK1100/led.c:127: error: expected ')' before 'mask'
../EVK1100/led.c:157: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Test'
../EVK1100/led.c:163: error: expected ')' before 'leds'
../EVK1100/led.c:184: error: expected ')' before 'leds'
../EVK1100/led.c:205: error: expected ')' before 'leds'
../EVK1100/led.c:226: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Read_Display_Field'
../EVK1100/led.c:232: error: expected ')' before 'field'
../EVK1100/led.c:238: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LED_Get_Intensity'
../EVK1100/led.c:253: error: expected ')' before 'leds'
make: *** [EVK1100/led.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project mygpio


Am I operating in the correct way? What is the error?
Can you help me please?
Thanks

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

Try also to add in the project options, linker, add linker path to the UTILS... etc

-sma

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

sma wrote:
Try also to add in the project options, linker, add linker path to the UTILS... etc

-sma

CAn you tell me how can I do it please? Where should I add this path?
Thanks!

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

Quote:
../EVK1100/evk1100.h:51:22: error: compiler.h: No such file or directory

I saw that you previously imported this file into your project. Is the logic file organization in your project flat? If not (for instance, maybe you imported compiler.h into a logic sub-folder), you may have to add the path to compiler.h (the one you previously imported into your project):

Project=>Properties=>C/C++ Build=>Tool Settings=>AVR32/GNU C Compiler=>Directories::Include paths(-I)

cbo.
.

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