Code: Select all
1 USB Virtual Root Hub (480 Mb/s)
|
+-2 USB 2.0 Hub (480 Mb/s, Not removable)
|
+-3 SMSC LAN9512 (480 Mb/s, Not removable)
|
+-0 No Device (Removable)
|
+-0 No Device (Removable)
usingHCD: Incorrectly compiled driver. HostGlobalRegs: 0x400 (0x400), CoreGlobalRegs: 0x401 (0x400), PowerReg: 0x7ffff14 (0x4).
USBD: Abort, HCD failed to initialise.
It looks like the structs have a different size than expected.. Any ideas ?make driver CONFIG=DEBUG TYPE=LOWLEVEL TARGET=RPI GNU=arm-none-eabi-
Code: Select all
extern volatile struct PowerReg {
volatile bool StopPClock : 1; // @0
volatile bool GateHClock : 1; // @1
volatile bool PowerClamp : 1; // @2
volatile bool PowerDownModules : 1; // @3
volatile bool PhySuspended : 1; // @4
volatile bool EnableSleepClockGating : 1; // @5
volatile bool PhySleeping : 1; // @6
volatile bool DeepSleep : 1; // @7
volatile unsigned _reserved8_31 : 24; // @8
} *PowerPhysical, *Power;
extern volatile struct MyStruct {
volatile bool StopPClock : 1; // @0
volatile bool GateHClock : 1; // @1
volatile bool PowerClamp : 1; // @2
volatile bool PowerDownModules : 1; // @3
volatile bool PhySuspended : 1; // @4
volatile bool EnableSleepClockGating : 1; // @5
volatile bool PhySleeping : 1; // @6
volatile bool DeepSleep : 1; // @7
volatile unsigned _mypadding : 24;
} *MyStruct1, *MyStruct2;
myHCD: size of MyStruct: 0x4
HCD: Incorrectly compiled driver. HostGlobalRegs: 0x400 (0x400),CoreGlobalRegs: 0x401 (0x400), PowerReg: 0x7ffff14 (0x4).
Code: Select all
sizeof(struct HostGlobalRegs), sizeof(struct CoreGlobalRegs));
Code: Select all
sizeof(struct HostGlobalRegs), sizeof(struct CoreGlobalRegs), sizeof(struct PowerReg));
Getting close but still no clue where the extra byte in the CoreGlobalRegs is coming from... Must be some padding trick the compiler is doing.. (BTW: I increased heap size to 32k to see if it would continue on the first error)CSUD: USB driver version 0.1
CSUD: HID driver version 0.1
CSUD: Hub driver version 0.1
CSUD: Keyboard driver version 0.1
CSUD: Mouse driver version 0.1
HCD: Reserving memory.
Platform: First memory allocation, reserving 32768B of heap, 256 entries.
Platform: malloc(0x400) = 0x40158. (1024/32768)
Platform: malloc(0x400) = 0x40558. (2048/32768)
Platform: malloc(0x8) = 0x40958. (2056/32768)
HCD: Hardware: Platform: free(0x40158) (1032/32768)
Platform: free(0x40558) (8/32768)
Platform: free(0x40958) (0/32768)
USBD: Abort, HCD failed to initialize
Code: Select all
Result HcdInitialise() {
volatile Result result;
if (sizeof(struct HostGlobalRegs) == 0x400) {
LOG_DEBUG("HCD: Reserving memory.\n");
CorePhysical = MemoryReserve(sizeof(struct CoreGlobalRegs), HCD_DESIGNWARE_BASE);
Core = MemoryAllocate(sizeof(struct CoreGlobalRegs));
// ...
return OK;
} else return ErrorCompiler;
deallocate:
if (Core != NULL) MemoryDeallocate((void *)Core);
if (Host != NULL) MemoryDeallocate((void *)Host);
if (Power != NULL) MemoryDeallocate((void *)Power);
return result;
}
Code: Select all
arm-none-eabi-objdump -d -j .text.HcdInitialise build/designware20.c.o
Code: Select all
volatile struct CoreReset {
volatile bool CoreSoft : 1; // @0
volatile bool HclkSoft : 1; // @1
volatile bool HostFrameCounter : 1; // @2
volatile bool InTokenQueueFlush : 1; // @3
volatile bool ReceiveFifoFlush : 1; // @4
volatile bool TransmitFifoFlush : 1; // @5
volatile enum CoreFifoFlush {
FlushNonPeriodic = 0,
FlushPeriodic1 = 1,
FlushPeriodic2 = 2,
FlushPeriodic3 = 3,
FlushPeriodic4 = 4,
FlushPeriodic5 = 5,
FlushPeriodic6 = 6,
FlushPeriodic7 = 7,
FlushPeriodic8 = 8,
FlushPeriodic9 = 9,
FlushPeriodic10 = 10,
FlushPeriodic11 = 11,
FlushPeriodic12 = 12,
FlushPeriodic13 = 13,
FlushPeriodic14 = 14,
FlushPeriodic15 = 15,
FlushAll = 16,
} TransmitFifoFlushNumber : 5; // @6
volatile unsigned _reserved11_29 : 19; // @11
volatile bool DmaRequestSignal : 1; // @30
volatile bool AhbMasterIdle : 1; // @31
} __attribute__ ((__packed__)) Reset; // +0x10
Sizes are correct now, still when run it gives:In file included from include/hcd/hcd.h:67:0,
from source/usbd/usbd.c:12:
include/hcd/dwc/designware20.h:296:2: note: offset of packed bit-field 'TransmitFifoFlushNumber' has changed in GCC 4.4
Using:CSUD: USB driver version 0.1
CSUD: HID driver version 0.1
CSUD: Hub driver version 0.1
CSUD: Keyboard driver version 0.1
CSUD: Mouse driver version 0.1
HCD: Reserving memory.
Platform: First memory allocation, reserving 32768B of heap, 256 entries.
Platform: Out of memory! We should've had more heap space in platform.c.
Platform: Out of memory! We should've had more heap space in platform.c.
Platform: Out of memory! We should've had more heap space in platform.c.
HCD: Hardware: OT2.80a (BCM2708a).
HCD: Internal DMA mode.
HCD: Hardware configuration: 00000000 228ddd50 0ff000e8 1ff00020
HCD: Host configuration: 00010000
HCD: Disabling interrupts.
HCD: Powering USB on.
HCD: Load completed.
HCD: Start core.
HCD: HCD uninitialised. Cannot be started.
USBD: Abort, HCD failed to USB keyboard initialized