Building Caterina & LUFA project in the Atmel studio 7

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

When i try to build the Caterina project (ehihc uses the LUFA  USB library) on ATMEL 7 it doesn't work. 

it tell me F_USB undefined symbol,so i tried to define the symbol under 

toolcahin>> ACR/GNU C compiler>> Cymbols 

F_CPU = 160000UL
F_USB = $(F_CPU)

 I get the following errors 

Severity	Code	Description	Project	File	Line
Error		160000UL: No such file or directory	SNSBootloader	avr-gcc.exe	0
Error		recipe for target 'main.o' failed	SNSBootloader	C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Makefile	100
Error		recipe for target 'Descriptors.o' failed	SNSBootloader	C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Makefile	93
Error		recipe for target 'Caterina.o' failed	SNSBootloader	C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Makefile	86
Error		=: No such file or directory	SNSBootloader	avr-gcc.exe	0
Error		=: No such file or directory	SNSBootloader	avr-gcc.exe	0
Error		=: No such file or directory	SNSBootloader	avr-gcc.exe	0
Error		=: No such file or directory	SNSBootloader	avr-gcc.exe	0
Error		=: No such file or directory	SNSBootloader	avr-gcc.exe	0
Error		160000UL: No such file or directory	SNSBootloader	avr-gcc.exe	0
Error		160000UL: No such file or directory	SNSBootloader	avr-gcc.exe	0
Error		=: No such file or directory	SNSBootloader	avr-gcc.exe	0

ANy suggestions !?!?! 

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

It is commonly

 

#define F_CPU 16000000UL

No equal sign. That is the way that C macros work.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

ka7ehk wrote:
No equal sign.
Jim, he's talking about the symbol definition in the project setting which passes it as a -D:

 

 

 If you use -D for something like F_CPU you really do use -DF_CPU=12345UL

 

As for analysing the errors. I would suggest Studio's "Error List" is worse than useless. Show the actual contents of the "Output" tab from the build which shows everything in chronological order.

 

It does look like the way you specified the symbols is malformed. As a quick experiment I tried:

 

 

When I build I see:

 

		Building file: .././main.c
		Invoking: AVR/GNU C Compiler : 5.4.0
		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG
                  -DF_CPU=123456UL -DF_USB= -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include" -O1 -ffunction-sections -fdata-sections
                  -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p" 
                  -c -std=gnu99 -save-temps -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c"
		Finished building: .././main.c

This tells us at least one thing (which I kind of guessed anyway!). Your use of:

F_USB=$(F_CPU)

simply isn't going to work. Just define it the same as F_CPU:

 

Last Edited: Wed. Oct 24, 2018 - 08:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

 

This tells us at least one thing (which I kind of guessed anyway!). Your use of:

F_USB=$(F_CPU)

simply isn't going to work. Just define it the same as F_CPU:

 

 

Ok I tried that and it didn't work , her is the output from the build. sounds like it is looking for a file 

 

 

------ Rebuild All started: Project: SNSBootloader, Configuration: Debug AVR ------
Build started.
Project "SNSBootloader.cproj" (Clean target(s)):
Target "Clean" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\SNSBootloader.cproj" (entry point):
	Using "RunCompilerTask" task from assembly "C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\Application\AvrGCC.dll".
	Task "RunCompilerTask"
		Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
		C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe clean 
		rm -rf  Caterina.o Descriptors.o main.o   
		rm -rf  Caterina.d Descriptors.d main.d   
		rm -rf "SNSBootloader.elf" "SNSBootloader.a" "SNSBootloader.hex" "SNSBootloader.lss" "SNSBootloader.eep" "SNSBootloader.map" "SNSBootloader.srec" "SNSBootloader.usersignatures"
	Done executing task "RunCompilerTask".
Done building target "Clean" in project "SNSBootloader.cproj".
Done building project "SNSBootloader.cproj".

Build succeeded.
------ Rebuild All started: Project: SNSBootloader, Configuration: Debug AVR ------
Build started.
Project "SNSBootloader.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\SNSBootloader.cproj" (target "Build" depends on it):
	Task "RunCompilerTask"
		Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
		C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 4 --output-sync 
		Building file: .././main.c
		Invoking: AVR/GNU C Compiler : 5.4.0
		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG -DF_CPU = 160000UL -DF_USB =  160000UL  -I"../../../../../LUFA-111009" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega32u4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega32u4" -c -std=gnu99 -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c" 
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Makefile(100,1): error: recipe for target 'main.o' failed
avr-gcc.exe(0,0): error: =: No such file or directory
avr-gcc.exe(0,0): error: 160000UL: No such file or directory
avr-gcc.exe(0,0): error: =: No such file or directory
avr-gcc.exe(0,0): error: 160000UL: No such file or directory
		make: *** [main.o] Error 1
		make: *** Waiting for unfinished jobs....
		Building file: .././Caterina.c
		Invoking: AVR/GNU C Compiler : 5.4.0
		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG -DF_CPU = 160000UL -DF_USB =  160000UL  -I"../../../../../LUFA-111009" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega32u4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega32u4" -c -std=gnu99 -MD -MP -MF "Caterina.d" -MT"Caterina.d" -MT"Caterina.o"   -o "Caterina.o" ".././Caterina.c" 
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Makefile(86,1): error: recipe for target 'Caterina.o' failed
avr-gcc.exe(0,0): error: =: No such file or directory
avr-gcc.exe(0,0): error: 160000UL: No such file or directory
avr-gcc.exe(0,0): error: =: No such file or directory
avr-gcc.exe(0,0): error: 160000UL: No such file or directory
		make: *** [Caterina.o] Error 1
		Building file: .././Descriptors.c
		Invoking: AVR/GNU C Compiler : 5.4.0
		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG -DF_CPU = 160000UL -DF_USB =  160000UL  -I"../../../../../LUFA-111009" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega32u4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega32u4" -c -std=gnu99 -MD -MP -MF "Descriptors.d" -MT"Descriptors.d" -MT"Descriptors.o"   -o "Descriptors.o" ".././Descriptors.c" 
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Makefile(93,1): error: recipe for target 'Descriptors.o' failed
avr-gcc.exe(0,0): error: =: No such file or directory
avr-gcc.exe(0,0): error: 160000UL: No such file or directory
avr-gcc.exe(0,0): error: =: No such file or directory
avr-gcc.exe(0,0): error: 160000UL: No such file or directory
		make: *** [Descriptors.o] Error 1
		The command exited with code 2.
	Done executing task "RunCompilerTask" -- FAILED.
Done building target "CoreBuild" in project "SNSBootloader.cproj" -- FAILED.
Done building project "SNSBootloader.cproj" -- FAILED.

Build FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

 

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

Remove the spaces around =

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

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

clawson wrote:

 

This tells us at least one thing (which I kind of guessed anyway!). Your use of:

F_USB=$(F_CPU)

simply isn't going to work. Just define it the same as F_CPU:

 

 

meolsen wrote:
Remove the spaces around =

 

Yes that was it , but now there is a new error . it says missing ";"

Severity	Code	Description	Project	File	Line
Error		expected expression before ';' token	SNSBootloader	C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\Caterina.c	603
Error		expected ')' before ',' token	SNSBootloader	C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\Caterina.c	767
Error		recipe for target 'Caterina.o' failed	SNSBootloader	C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Makefile	86

and here is the build output . it doesn't like 

		.././Caterina.c: In function 'CDC_Task':
<command-line>(0,17): error: 'UL' undeclared (first use in this function)
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\Caterina.c(603,58): info: in expansion of macro 'BOOT_START_ADDR'
		   for (uint32_t CurrFlashAddress = 0; CurrFlashAddress < BOOT_START_ADDR; CurrFlashAddress += SPM_PAGESIZE)
		                                                          ^
<command-line>(0,17): info: each undeclared identifier is reported only once for each function it appears in
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\Caterina.c(603,58): info: in expansion of macro 'BOOT_START_ADDR'
		   for (uint32_t CurrFlashAddress = 0; CurrFlashAddress < BOOT_START_ADDR; CurrFlashAddress += SPM_PAGESIZE)
		                                                          ^
		.././Caterina.c: In function 'BMem':
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Makefile(86,1): error: recipe for target 'Caterina.o' failed
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\Caterina.c(816,5): warning: assignment makes integer from pointer without a cast [-Wint-conversion]
		  w  =  "Bemin01234";
		     ^
		.././Caterina.c: At top level:
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\Caterina.c(853,9): warning: "/*" within comment [-Wcomment]
		         /* Fill buffer first, as EEPROM is too slow to copy with UART speed
		         ^
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\Caterina.c(857,9): warning: "/*" within comment [-Wcomment]
		         /* Then program the EEPROM
		         ^
		make: *** [Caterina.o] Error 1
		make: *** Waiting for unfinished jobs....
		Building file: .././main.c
		Invoking: AVR/GNU C Compiler : 5.4.0
		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG -DF_CPU=16000000UL -DF_USB=F_CPU -DBOOT_START_ADDR=UL -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DUSB_DEVICE_ONLY -DDEVICE_STATE_AS_GPIOR=0 -DORDERED_EP_CONFIG -DUSE_RAM_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DNO_INTERNAL_SERIAL -DNO_DEVICE_SELF_POWER -DNO_DEVICE_REMOTE_WAKEUP -DNO_SOF_EVENTS  -I"../../../../../LUFA-111009" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega32u4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega32u4" -c -std=gnu99 -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c"
		Finished building: .././main.c
		Building file: .././Descriptors.c
		Invoking: AVR/GNU C Compiler : 5.4.0
		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG -DF_CPU=16000000UL -DF_USB=F_CPU -DBOOT_START_ADDR=UL -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DUSB_DEVICE_ONLY -DDEVICE_STATE_AS_GPIOR=0 -DORDERED_EP_CONFIG -DUSE_RAM_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DNO_INTERNAL_SERIAL -DNO_DEVICE_SELF_POWER -DNO_DEVICE_REMOTE_WAKEUP -DNO_SOF_EVENTS  -I"../../../../../LUFA-111009" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega32u4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega32u4" -c -std=gnu99 -MD -MP -MF "Descriptors.d" -MT"Descriptors.d" -MT"Descriptors.o"   -o "Descriptors.o" ".././Descriptors.c"
		Finished building: .././Descriptors.c
	Done executing task "RunCompilerTask" -- FAILED.
Done building target "CoreBuild" in project "SNSBootloader.cproj" -- FAILED.
Done building project "SNSBootloader.cproj" -- FAILED.

Build FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

it seems it doesn't like the following line but why ? I had to add a symbols  in the compiler to define "BOOT_START_ADD"

 

and that is what i added 

BOOT_START_ADDR=$(BOOT_START)UL

and now it is giving me that error 

for (uint32_t CurrFlashAddress = 0; CurrFlashAddress < BOOT_START_ADDR; CurrFlashAddress += SPM_PAGESIZE)
		{
			boot_page_erase(CurrFlashAddress);
			boot_spm_busy_wait();
			boot_page_write(CurrFlashAddress);
			boot_spm_busy_wait();
		}

 

Last Edited: Thu. Oct 25, 2018 - 01:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay I fixed this one, I did the following 

BOOT_START=0x7000

BOOT_START_ADDR=BOOT_START

but now it is giving me another error

:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Caterina.c(1,1): error: undefined reference to `USB_Init'
		Caterina.o: In function `main':
C:\Users\bghobreal\Documents\Atmel Studio\7.0\SNSBootloader\SNSBootloader\Caterina.c(1,1): error: undefined reference to `USB_USBTask'
collect2.exe(0,0): error: ld returned 1 exit status

I have boupdated the path to include the LUFA Path in both 

Liberary search and in Directories but still can't find it  usb_init()

any suggestions ?

 

Last Edited: Thu. Oct 25, 2018 - 01:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Undef ref means no .o in  the link contains the named function.