Missing LUFAduino define for ATmega32u4

33 views
Skip to first unread message

OP

unread,
Mar 6, 2011, 12:36:55 PM3/6/11
to Micropendous
I was trying out the LUFAduino example in trunk and encountered:

libs/arduino/hardware/arduino/cores/micropendous/pins_micropendous.c:
280: error: 'TIMER4D' undeclared here

It looks like TIMER4D is never defined in pins_micropendous.h, but is
used in pins_micropendous.c and wiring_analog.c. For now, I simply
added it to pins_micropendous.h, since it doesn't look like the
associated numerical values are directly used:

...
#define TIMER4A 11
#define TIMER4B 12
#define TIMER4C 13
#define TIMER4D 14
#define TIMER5A 15
#define TIMER5B 16
#define TIMER5C 17

-ojas

OP

unread,
Mar 6, 2011, 12:53:52 PM3/6/11
to Micropendous
Another Atmega32u4 issue:

Sketch.cpp: In function 'void SetupHardware()':
Sketch.cpp:310: error: 'PE7' was not declared in this scope

This is due to SELECT_USB_B, which is defined in libs/LUFA/LUFA/
UsefulMicropendousDefines.h:

// Defines related to the USB Signal and Power
Switches
// which are under control of Pin
PE7
#if (BOARD == BOARD_MICROPENDOUS)
#ifndef SELECT_USB_B
#define SELECT_USB_B PORTE |= (1 << PE7);
DDRE |= (1 << PE7);
#endif
...


Message has been deleted

Opendous Support

unread,
Mar 6, 2011, 9:11:40 PM3/6/11
to Micropendous
Thanks for pointing these errors out. I will fix them for the next
release within the next few days.

That PE7 error should not occur. Did you set BOARD = USER in the
makefile? BOARD = MICROPENDOUS won't work properly as 'MICROPENDOUS'
is the setting for the AT90USB1287-based boards with external SRAM.
http://code.google.com/p/micropendous/wiki/Micropendous
http://code.google.com/p/micropendous/wiki/MicropendousDIP

BOARD = USER will work on all other Micropendous1/2/3/4/32U2 boards.

OP

unread,
Mar 6, 2011, 10:29:29 PM3/6/11
to Micropendous
Gotcha. I used to use BOARD=USER but noticed on the LUFA blog that
MICROPENDOUS was now an option and figured I ought to give it a whirl.

BTW, the arduino code I'm porting makes use of the various println()
functionn, including printing in hex. I thought my efforts would be
better spent updating micropendous's USBVirtualSerial class code
rather than modifying mine. My guess is that you had intended to
eventually let the USBVirtualSerial class in libs/arduino/hardware/
arduino/cores/micropendous/WiringVirtualSerial.h derive from the Print
class. I'm working on this and was wondering where the object
declared "extern USBVirtualSerial Serial" in WiringVirtualSerial.h is
actually defined.

Thanks for putting out excellent products both in terms of hardware
and software support.

On Mar 6, 7:11 pm, Opendous Support <opendous.supp...@gmail.com>
wrote:
> Thanks for pointing these errors out.  I will fix them for the next
> release within the next few days.
>
> That PE7 error should not occur.  Did you set BOARD = USER in the
> makefile?  BOARD = MICROPENDOUS won't work properly as 'MICROPENDOUS'
> is the setting for the AT90USB1287-based boards with external SRAM.http://code.google.com/p/micropendous/wiki/Micropendoushttp://code.google.com/p/micropendous/wiki/MicropendousDIP

OP

unread,
Mar 7, 2011, 3:34:46 AM3/7/11
to Micropendous
I scratched my head on this one for awhile but finally figured out
where the "extern USBVirtualSerial Serial" object was instantiated --
it wasn't! I was really stumped when I added a private default
constructor to USBVirtualSerial and things still worked. Turns out
that for the LUFAduino example, the calls to members of Serial were
all inlined (and essentially static), so the actual need for an
instance was optimized away -- this is my guess at least.

When I tried deriving USBVirtualSerial from the Print class for my
code:

[WiringVirtualSerial.h]
...
class USBVirtualSerial : public Print
...
[EOF]

this cause a undefined reference to Serial when linking. This is
consistent with the above theory since my code couldn't get away with
inlining all its calls to members of Serial. I then tried to add a
declaration for the USBVirtualSerial Serial object to a new .cpp file:

[new file USBVirtualSerial.cpp]

#include "WiringVirtualSerial.h"

// Preinstantiate
Objects //////////////////////////////////////////////////////

USBVirtualSerial Serial;
[EOF]

I noticed that the above file was referenced from the makefile
anwyay. This didn't work as expected either. There's a file called
USBVirtualSerial.c, and my guess is that make decides it can generate
USBVirtualSerial.o from the USBVirtualSerial.c file, and so doesn't
bother trying to compile the USBVirtualSerial.cpp file. I suppose
the .o would collide even if it did. My final attempt was the
following:

[new file WiringVirtualSerial.cpp]

#include "WiringVirtualSerial.h"

// Preinstantiate
Objects //////////////////////////////////////////////////////

USBVirtualSerial Serial;
[EOF]

I modified the makefile accordingly and the above seems to compile
just fine (with USBVirtualSerial now derived from Print).

-ojas
Reply all
Reply to author
Forward
0 new messages