User forums > Embedded development

LUFA+CodeBlocks

(1/2) > >>

adolfoe:
Hello,

I am trying to work on a project using the C::B ide with the LUFA USB stack for AVR microcontrollers.

I am using the avr8-gnu-toolchain for windows.

I am trying to adapt the steps from the following page to to C::B: http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__exporting_library.html

However I have not been able to find the same options of the AVR studio on the compiler settings options of C::B.

What I have done is the following:

1) I found the -O1 flag on the option and selected it
2) The additional optimization options (-ffunction-section, -fpack-struct and -fshort-enums), I put them under Compiler settings->Other compiler options
3) The options that the pages tell me to add under the GCC compiler Symbols, I added them under the Compiler settings->#defines tab
4) The Linker Optimization options I added (--gc-sections) unde the Linker settings->Other linker options

Questions:
Could someone please let me know if I am doing this correctly, or if I am misinterpreting some step?
Sould I also add the -Wl option to the Other linker options?

Thanks in advance for your help.



oBFusCATed:
Looks correct to me.
The --gc-sections option should make the binary smaller. If you remove it then the binary size should rise. If nothing happens add -Wl, in front of it.

adolfoe:
Hello,

Thanks for your support.

I am experiencing the following problem when I try to compile:

LUFA\CodeTemplates\DeviceTemplate\Descriptors.h|40|fatal error: LUFA/Drivers/USB/USB.h: No such file or directory|

This is triggered by the following line on one of the headers:
      #include <LUFA/Drivers/USB/USB.h>

I have already added the LUFA path to the Compiler Settings->Search Directory

Is there anything else that I am missing?

BlueHazzard:
Always post a full rebuild log if you have compiling problems: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

adolfoe:
Here is the build log:


--- Code: ----------------- Build: Release in LUFA-test (compiler: GNU GCC Compiler for AVR)---------------
avr-gcc.exe -Wall -mmcu=at90usb1286 -DF_CPU=16000000UL -Os -std=c11 -IC:\WinAVR\avr\include -IC:\avr8-gnu-toolchain\avr\include -IC:\Users\adolfo1x\Documents\GitHub\USB-FreelancerDevice\LUFA-test\LUFA -c LUFA\CodeTemplates\DeviceTemplate\Descriptors.c -o obj\Release\LUFA\CodeTemplates\DeviceTemplate\Descriptors.o
avr-gcc.exe -Wall -mmcu=at90usb1286 -DF_CPU=16000000UL -Os -std=c11 -IC:\WinAVR\avr\include -IC:\avr8-gnu-toolchain\avr\include -IC:\Users\adolfo1x\Documents\GitHub\USB-FreelancerDevice\LUFA-test\LUFA -c LUFA\CodeTemplates\DeviceTemplate\DeviceApplication.c -o obj\Release\LUFA\CodeTemplates\DeviceTemplate\DeviceApplication.o
avr-gcc.exe -Wall -mmcu=at90usb1286 -DF_CPU=16000000UL -Os -std=c11 -IC:\WinAVR\avr\include -IC:\avr8-gnu-toolchain\avr\include -IC:\Users\adolfo1x\Documents\GitHub\USB-FreelancerDevice\LUFA-test\LUFA -c LUFA\CodeTemplates\HostTemplate\HostApplication.c -o obj\Release\LUFA\CodeTemplates\HostTemplate\HostApplication.o
avr-gcc.exe -Wall -mmcu=at90usb1286 -DF_CPU=16000000UL -Os -std=c11 -IC:\WinAVR\avr\include -IC:\avr8-gnu-toolchain\avr\include -IC:\Users\adolfo1x\Documents\GitHub\USB-FreelancerDevice\LUFA-test\LUFA -c LUFA\Drivers\USB\Class\Device\AudioClassDevice.c -o obj\Release\LUFA\Drivers\USB\Class\Device\AudioClassDevice.o
In file included from LUFA\CodeTemplates\DeviceTemplate\Descriptors.c:38:0:
LUFA\CodeTemplates\DeviceTemplate\Descriptors.h:40:36: fatal error: LUFA/Drivers/USB/USB.h: No such file or directory
#include <LUFA/Drivers/USB/USB.h>
^
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
In file included from LUFA\CodeTemplates\DeviceTemplate\DeviceApplication.c:38:0:
LUFA\CodeTemplates\DeviceTemplate\DeviceApplication.h:44:38: fatal error: LUFA/Platform/Platform.h: No such file or directory
#include <LUFA/Platform/Platform.h>
^
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
In file included from LUFA\CodeTemplates\HostTemplate\HostApplication.c:38:0:
LUFA\CodeTemplates\HostTemplate\HostApplication.h:44:36: fatal error: LUFA/Drivers/USB/USB.h: No such file or directory
#include <LUFA/Drivers/USB/USB.h>
^
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
In file included from LUFA\Drivers\USB\Class\Device\../../Core/USBController.h:150:0,
from LUFA\Drivers\USB\Class\Device\../../Core/USBTask.h:47,
from LUFA\Drivers\USB\Class\Device\../../USB.h:386,
from LUFA\Drivers\USB\Class\Device\AudioClassDevice.h:57,
from LUFA\Drivers\USB\Class\Device\AudioClassDevice.c:38:
LUFA\Drivers\USB\Class\Device\../../Core/AVR8/USBController_AVR8.h:84:5: error: #error F_USB is not defined. You must define F_USB to the frequency of the unprescaled USB controller clock in your project makefile.
#error F_USB is not defined. You must define F_USB to the frequency of the unprescaled USB controller clock in your project makefile.
^
In file included from LUFA\Drivers\USB\Class\Device\../../Core/USBController.h:150:0,
from LUFA\Drivers\USB\Class\Device\../../Core/USBTask.h:47,
from LUFA\Drivers\USB\Class\Device\../../USB.h:386,
from LUFA\Drivers\USB\Class\Device\AudioClassDevice.h:57,
from LUFA\Drivers\USB\Class\Device\AudioClassDevice.c:38:
LUFA\Drivers\USB\Class\Device\../../Core/AVR8/USBController_AVR8.h:114:5: error: #error No PLL prescale value available for chosen F_USB value and AVR model.
#error No PLL prescale value available for chosen F_USB value and AVR model.
^
LUFA\Drivers\USB\Class\Device\../../Core/AVR8/USBController_AVR8.h: In function 'USB_PLL_On':
LUFA\Drivers\USB\Class\Device\../../Core/AVR8/USBController_AVR8.h:330:14: error: 'USB_PLL_PSC' undeclared (first use in this function)
PLLCSR = USB_PLL_PSC;
^
LUFA\Drivers\USB\Class\Device\../../Core/AVR8/USBController_AVR8.h:330:14: note: each undeclared identifier is reported only once for each function it appears in
Process terminated with status 1 (0 minute(s), 0 second(s))
6 error(s), 0 warning(s) (0 minute(s), 0 second(s))
--- End code ---

Thanks for your suggestion

Navigation

[0] Message Index

[#] Next page

Go to full version