riverajl
Posts: 10
Joined: Thu Dec 06, 2018 10:03 am

Re: CSUD - Chadderz's Simple USB Driver (Source)

Tue Dec 11, 2018 11:01 am

Hi, thanks.

I already did this interfacing with mailbox. I will try tonight.

Att,

José Luiz

riverajl
Posts: 10
Joined: Thu Dec 06, 2018 10:03 am

Re: CSUD - Chadderz's Simple USB Driver (Source)

Tue Dec 11, 2018 9:01 pm

It worked.

Thanks a lot

riverajl
Posts: 10
Joined: Thu Dec 06, 2018 10:03 am

Re: CSUD - Chadderz's Simple USB Driver (Source)

Wed Dec 12, 2018 10:23 am

Dear. Does your single source for csud solution implements interrupt for usb?

If not, is there any direction for getting it?

Tkanks.

José Luiz

LdB
Posts: 1549
Joined: Wed Dec 07, 2016 2:29 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Wed Dec 12, 2018 2:32 pm

It doesn't have it .. but given you got the rest sorted you have the skill to do it

Below is the register setup on DWC core itself to pass the interrupt out to the ARM
The 3rd section interrupt handler I assume you already have or will do yourself I will throw a sample of it at end

Code: Select all

static void dwc_setup_interrupts(void)
{
    union dwc_core_interrupts core_interrupt_mask;

    /* Clear all pending core interrupts.  */
    regs->core_interrupt_mask.val = 0;
    regs->core_interrupts.val = 0xffffffff;

    /* Enable core host channel and port interrupts.  */
    core_interrupt_mask.val = 0;
    core_interrupt_mask.host_channel_intr = 1;
    core_interrupt_mask.port_intr = 1;
    regs->core_interrupt_mask = core_interrupt_mask;

    /* Enable the interrupt line that goes to the USB controller and register
     * the interrupt handler.  .... You will need to do this yourself */
    interruptVector[IRQ_USB] = dwc_interrupt_handler;
    enable_irq(IRQ_USB);

    /* Enable interrupts for entire USB host controller.  (Yes that's what we
     * just did, but this one is controlled by the host controller itself.)  */
    regs->ahb_configuration |= DWC_AHB_INTERRUPT_ENABLE;
}
You simply have to respond to each interrupt, read the interrupt source and clear it like any peripheral interrupt.

So this is my multicore version of an irq system, in your case you probably only want 1 core so just hard code coreId as 0 you can even simplify it.
It just reads the 3 interrupts registers on the ARM and assign numbers to the interrupts. Those irq's are numbered
0..83 assuming a Pi3 (72 on a Pi1) and you can assign a function to call if that irq is seen etc I am sure you will understand it.
It ends up pretty much as the table on Page 113 of the datasheet BCM2835-ARM-Peripherals.pdf
From memory the usb is bit9 in the pending1 register so on my system it will be Irq 41

You direct your irq vector table entry in your bootstub to here

Code: Select all

/* Entry point for all core interrupt handlers, each core must direct it's Irq vector to here */
void irqHandler(void);
Anyhow here is the system .. hopefully it helps mainly look at rpi-Irq.c
https://github.com/LdB-ECM/Exchange/tree/master/Irq

riverajl
Posts: 10
Joined: Thu Dec 06, 2018 10:03 am

Re: CSUD - Chadderz's Simple USB Driver (Source)

Wed Dec 12, 2018 6:16 pm

I already have used interrupts.

There are ever a register to enable, to disable, to know the source and to clear the irq pending. Searching BCM2837 datasheet I could not find any register to clear USB interrupt.

Is there any one?

Tks

LdB
Posts: 1549
Joined: Wed Dec 07, 2016 2:29 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Wed Dec 12, 2018 11:32 pm

The clear is on the peripheral not the BCM system on chip.
CSUD .... designware20.h and look at the interrupt registers.

User avatar
Ultibo
Posts: 161
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: CSUD - Chadderz's Simple USB Driver (Source)

Thu Dec 13, 2018 11:31 pm

riverajl wrote:
Wed Dec 12, 2018 6:16 pm
I already have used interrupts.

There are ever a register to enable, to disable, to know the source and to clear the irq pending. Searching BCM2837 datasheet I could not find any register to clear USB interrupt.

Is there any one?

Tks
The documentation for the USB host in the Pi has never been made public so anything that is known comes from existing sources.

If you are interested in going beyond the capabilities of the CSUD driver you might want to look at some of the other projects that implement much more of the functionality including interrupts.

Here's a few to look at:

Circle (https://github.com/rsta2/circle)

USPi (https://github.com/rsta2/uspi)

XINU (https://github.com/xinu-os/xinu)

Ultibo (https://github.com/ultibohub/Core)
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

liletian.us
Posts: 43
Joined: Fri Aug 16, 2019 3:57 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Thu Aug 22, 2019 6:00 am

Hi LdB

I am facing the similar problem here, can you please share your code and experience to help me out?

I am trying to do the class with raspberry B+ and the input02 class does not work at all.

Thanks,

Brian
LdB wrote:
Mon Dec 10, 2018 11:48 pm
The DMA transfer section needs to be fixed up to a non cache address the raw address CSUD uses in DMA will only work on a Pi1.

Basically OR 0xC0000000 to any address passed to the DMA ... if you do not yet understand why you will need to read up on it.
https://www.raspberrypi.org/documentati ... dresses.md

It is along the same lines of having to change 0x20xx xxxx to 0x3Fxx xxxx addresses and depending how advanced you have so far coded you may or may not have run across it. I think most refer to is as the bus alias.

So this is wrong (0xC0000000 needs to be OR'ed to the address)

Code: Select all

Host->Channel[channel].DmaAddress = buffer;

LdB
Posts: 1549
Joined: Wed Dec 07, 2016 2:29 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Thu Aug 22, 2019 6:24 am

Having a quick look at the CSUD repository I think all that is required is

On the original CSUD source, designware20.c line 278
https://github.com/Chadderz121/csud/blo ... gnware20.c

currently

Code: Select all

Host->Channel[channel].DmaAddress = buffer;
needs to be something like (it may need typecasting, I haven't compiled)

Code: Select all

Host->Channel[channel].DmaAddress = buffer;
Host->Channel[channel].DmaAddress |= 0xC0000000;

You also need to change the base address configuration.h, line 39
https://github.com/Chadderz121/csud/blo ... guration.h
currently

Code: Select all

define HCD_DESIGNWARE_BASE ((void*)0x20980000)
needs to be

Code: Select all

define HCD_DESIGNWARE_BASE ((void*)0x3F980000)

liletian.us
Posts: 43
Joined: Fri Aug 16, 2019 3:57 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Thu Aug 22, 2019 4:18 pm

Hi LdB

Thank you very much for the reply.

after I modify it, it reports the following errors.

include/device/hid/hid.h:164:8: warning: extra tokens at end of #endif directive [enabled by default]
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/hcd/dwc/designware20.c -o build/designware20.c.o
source/hcd/dwc/designware20.c: In function 'HcdTransmitChannel':
source/hcd/dwc/designware20.c:279:36: error: invalid operands to binary | (have 'volatile void * volatile' and 'unsigned int')
make: *** [build/designware20.c.o] Error

The command I am using is
make driver CONFIG=DEBUG TYPE=STANDALONE TARGET=RPI GNU=arm-none-eabi-

Also, I assume I need to change all the ox20xxxx address to 0x3Fxxx, right?

Those files are in
/Users/liletian/Desktop/csud-master/include/configuration.h


how about 0x20? for example,
in
/Users/liletian/Desktop/csud-master/include/hcd/dwc/designware20.h

RegReceivePop = 0x20,
volatile const struct ReceiveStatus Pop; // Read Only +0x20

/Users/liletian/Desktop/csud-master/include/device/hid/report.h

/Users/liletian/Desktop/csud-master/source/device/hub.c
if ((result = UsbGetDescriptor(device, Hub, 0, 0, &header, sizeof(header), sizeof(header), 0x20)) != OK) {
if ((result = UsbGetDescriptor(device, Hub, 0, 0, ((struct HubDevice*)device->DriverData)->Descriptor, header.DescriptorLength, header.DescriptorLength, 0x20)) != OK) {
.Type = 0x20,


/Users/liletian/Desktop/csud-master/source/hcd/dwc/roothub.c

case 0x20:
WriteThroughRegMask(&Host->Port, 0x20);
case 0x20:


/Users/liletian/Desktop/csud-master/source/platform/arm/broadcom2835.c
volatile u64* timeStamp = (u64*)0x20003004;
mailbox = (u32*)0x2000B880;

Do I also need to change
do {
while (mailbox[6] & 0x40000000);
} while (((result = mailbox[0]) & 0xf) != 0);

to

do {
while (mailbox[6] & 0xC0000000);
} while (((result = mailbox[0]) & 0xf) != 0);



/Users/liletian/Desktop/csud-master/source/usbd/usbd.c

else if (device->Descriptor.UsbVersion == 0x200)
else if (device->Descriptor.UsbVersion == 0x200)


do I need to change it to 3F as well? I am guess not.

Thanks you very much,

Brian

LdB wrote:
Thu Aug 22, 2019 6:24 am
Having a quick look at the CSUD repository I think all that is required is

On the original CSUD source, designware20.c line 278
https://github.com/Chadderz121/csud/blo ... gnware20.c

currently

Code: Select all

Host->Channel[channel].DmaAddress = buffer;
needs to be something like (it may need typecasting, I haven't compiled)

Code: Select all

Host->Channel[channel].DmaAddress = buffer;
Host->Channel[channel].DmaAddress |= 0xC0000000;

You also need to change the base address configuration.h, line 39
https://github.com/Chadderz121/csud/blo ... guration.h
currently

Code: Select all

define HCD_DESIGNWARE_BASE ((void*)0x20980000)
needs to be

Code: Select all

define HCD_DESIGNWARE_BASE ((void*)0x3F980000)

liletian.us
Posts: 43
Joined: Fri Aug 16, 2019 3:57 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Fri Aug 23, 2019 4:11 pm

Hi LdB

I changed your code from https://github.com/Chadderz121/csud/blo ... gnware20.c

from Host->Channel[channel].DmaAddress |= 0xC0000000;[/code]

to

Host->Channel[channel].DmaAddress =(u32)(Host->Channel[channel].DmaAddr\
ess)| 0xC0000000;

In order to make it compile.

After that, I am using command make driver CONFIG=DEBUG TYPE=STANDALONE TARGET=RPI GNU=arm-none-eabi-

to generate the library.

It can type one letter now. But once after the one letter, it sticks there. I can unplug the keyboard and plug again, then I can type the second letter.

Do you what is the problem here?

Thank you,

Brian
LdB wrote:
Thu Aug 22, 2019 6:24 am
Having a quick look at the CSUD repository I think all that is required is

On the original CSUD source, designware20.c line 278
https://github.com/Chadderz121/csud/blo ... gnware20.c

currently

Code: Select all

Host->Channel[channel].DmaAddress = buffer;
needs to be something like (it may need typecasting, I haven't compiled)

Code: Select all

Host->Channel[channel].DmaAddress = buffer;
Host->Channel[channel].DmaAddress |= 0xC0000000;

You also need to change the base address configuration.h, line 39
https://github.com/Chadderz121/csud/blo ... guration.h
currently

Code: Select all

define HCD_DESIGNWARE_BASE ((void*)0x20980000)
needs to be

Code: Select all

define HCD_DESIGNWARE_BASE ((void*)0x3F980000)

LdB
Posts: 1549
Joined: Wed Dec 07, 2016 2:29 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 3:42 am

Your compiling is fine I must have missed something ... it looks like the IRQ is stuck ... let me look.

https://github.com/Chadderz121/csud/blo ... dcom2835.c
line 23

Code: Select all

volatile u64* timeStamp = (u64*)0x3F003004;
line 34

Code: Select all

mailbox = (u32*)0x3F00B880;
Last edited by LdB on Sat Aug 24, 2019 3:53 am, edited 1 time in total.

liletian.us
Posts: 43
Joined: Fri Aug 16, 2019 3:57 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 3:46 am

Hi LdB

Thank you very much, please help me out.

Can you share your modify code?

You are right, maybe it is like an IRQ stuck and I am working on the wrong direction. :(

Thank you,

Brian
LdB wrote:
Sat Aug 24, 2019 3:42 am
Your compiling is fine I must have missed something ... it looks like the IRQ is stuck ... let me look.

LdB
Posts: 1549
Joined: Wed Dec 07, 2016 2:29 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 3:54 am

You responded before I edited .. just incase you missed it

https://github.com/Chadderz121/csud/blo ... dcom2835.c
line 23

Code: Select all

volatile u64* timeStamp = (u64*)0x3F003004;
line 34

Code: Select all

mailbox = (u32*)0x3F00B880;

liletian.us
Posts: 43
Joined: Fri Aug 16, 2019 3:57 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 3:57 am

Hi LdB

Thanks you for the help. I am waiting for your help all the day, so I replied quick. :)

Yes, those had been modified.

It still stuck after one type in letter. :(

Thanks,

Brian
LdB wrote:
Sat Aug 24, 2019 3:54 am
You responded before I edited .. just incase you missed it

https://github.com/Chadderz121/csud/blo ... dcom2835.c
line 23

Code: Select all

volatile u64* timeStamp = (u64*)0x3F003004;
line 34

Code: Select all

mailbox = (u32*)0x3F00B880;

LdB
Posts: 1549
Joined: Wed Dec 07, 2016 2:29 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 4:02 am

Sorry just clarifying so you have hooked up the IRQ or are you software polling the driver?

The article you linked does software polling via this sequence
1. Retrieve a stored keyboard address (initially 0).
2. If this is not 0, go to 9.
3. Call UsbCheckForChange to detect new keyboards.
4. Call KeyboardCount to detect how many keyboards are present.
5. If this is 0 store the address as 0 and return; we can't do anything with no keyboard.
6. Call KeyboardGetAddress with parameter 0 to get the first keyboard's address.
7. Store this address.
8. If this is 0, return; there is some problem.
9. Call KeyboardGetKeyDown 6 times to get each key currently down and store them
10. Call KeyboardPoll
11. If the result is non-zero go to 3. There is some problem (such as disconnected keyboard).
Last edited by LdB on Sat Aug 24, 2019 4:09 am, edited 1 time in total.

liletian.us
Posts: 43
Joined: Fri Aug 16, 2019 3:57 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 4:03 am

I changed the code to remove one warning.

Host->Channel[channel].DmaAddress = buffer;
Host->Channel[channel].DmaAddress = (void*)((u32)Host->Channel[channel].DmaAddress|(0xC0000000));


Do I need to change arm1176jzf-s to something else since this is the raspberry pi B+?

Thank you very much,

Brian

Here is the compile results.

Bos-MacBook-Air:csud-master liletian$ make driver CONFIG=FINAL TYPE=STANDALONE TARGET=RPI GNU=arm-none-eabi-
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/configuration.c -o build/configuration.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/device/hub.c -o build/hub.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/device/hid/hid.c -o build/hid.c.o
In file included from source/device/hid/hid.c:16:0:
include/device/hid/hid.h:164:8: warning: extra tokens at end of #endif directive [enabled by default]
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/device/hid/keyboard.c -o build/keyboard.c.o
In file included from source/device/hid/keyboard.c:13:0:
include/device/hid/hid.h:164:8: warning: extra tokens at end of #endif directive [enabled by default]
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/device/hid/mouse.c -o build/mouse.c.o
In file included from source/device/hid/mouse.c:13:0:
include/device/hid/hid.h:164:8: warning: extra tokens at end of #endif directive [enabled by default]
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/hcd/dwc/designware20.c -o build/designware20.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/hcd/dwc/roothub.c -o build/roothub.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/platform/platform.c -o build/platform.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/platform/arm/broadcom2835.c -o build/broadcom2835.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/platform/arm/armv6.c -o build/armv6.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DFINAL -O2 -Wno-strict-aliasing -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/usbd/usbd.c -o build/usbd.c.o
rm -f libcsud.a
arm-none-eabi-ar rc libcsud.a build/configuration.c.o build/hub.c.o build/hid.c.o build/keyboard.c.o build/mouse.c.o build/designware20.c.o build/roothub.c.o build/platform.c.o build/broadcom2835.c.o build/armv6.c.o build/usbd.c.o

liletian.us wrote:
Sat Aug 24, 2019 3:57 am
Hi LdB

Thanks you for the help. I am waiting for your help all the day, so I replied quick. :)

Yes, those had been modified.

It still stuck after one type in letter. :(

Thanks,

Brian
LdB wrote:
Sat Aug 24, 2019 3:54 am
You responded before I edited .. just incase you missed it

https://github.com/Chadderz121/csud/blo ... dcom2835.c
line 23

Code: Select all

volatile u64* timeStamp = (u64*)0x3F003004;
line 34

Code: Select all

mailbox = (u32*)0x3F00B880;

liletian.us
Posts: 43
Joined: Fri Aug 16, 2019 3:57 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 4:06 am

Hi LdB

I am not sure, I am using the code from https://github.com/Chadderz121/csud/tre ... c0416df61e

Only change the base address from 0x20xxxx to 0x3Fxxxx and change the command line as you suggested.

How can I see if it is IRQ or software polling? It will be my next task. :(

Thank you very much,

Brian
LdB wrote:
Sat Aug 24, 2019 4:02 am
Sorry just clarifying so you have hooked up the IRQ or are you software polling the driver?

LdB
Posts: 1549
Joined: Wed Dec 07, 2016 2:29 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 4:21 am

Try Compiling it in DEBUG mode and lets see what log says

liletian.us
Posts: 43
Joined: Fri Aug 16, 2019 3:57 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 4:29 am

I compile it in log mode, I saw the following.

Where is the log file? :(

Thanks,

Brian

Bos-MacBook-Air:csud-master liletian$ make clean
rm -f build/armv6.c.o build/broadcom2835.c.o build/configuration.c.o build/designware20.c.o build/hid.c.o build/hub.c.o build/keyboard.c.o build/mouse.c.o build/platform.c.o build/roothub.c.o build/usbd.c.o
rm -f libcsud.a
Bos-MacBook-Air:csud-master liletian$ make driver CONFIG=DEBUG TYPE=STANDALONE TARGET=RPI GNU=arm-none-eabi-
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/configuration.c -o build/configuration.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/device/hub.c -o build/hub.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/device/hid/hid.c -o build/hid.c.o
In file included from source/device/hid/hid.c:16:0:
include/device/hid/hid.h:164:8: warning: extra tokens at end of #endif directive [enabled by default]
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/device/hid/keyboard.c -o build/keyboard.c.o
In file included from source/device/hid/keyboard.c:13:0:
include/device/hid/hid.h:164:8: warning: extra tokens at end of #endif directive [enabled by default]
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/device/hid/mouse.c -o build/mouse.c.o
In file included from source/device/hid/mouse.c:13:0:
include/device/hid/hid.h:164:8: warning: extra tokens at end of #endif directive [enabled by default]
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/hcd/dwc/designware20.c -o build/designware20.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/hcd/dwc/roothub.c -o build/roothub.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/platform/platform.c -o build/platform.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/platform/arm/broadcom2835.c -o build/broadcom2835.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/platform/arm/armv6.c -o build/armv6.c.o
arm-none-eabi-gcc -std=c99 -fpack-struct -Wno-packed-bitfield-compat -fshort-wchar -Wall -DDEBUG -DTYPE_STANDALONE -DTARGET_RPI -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s -DLIB_HUB -DLIB_HID -DLIB_KBD -DLIB_MOUSE -c -Iinclude/ source/usbd/usbd.c -o build/usbd.c.o
rm -f libcsud.a
arm-none-eabi-ar rc libcsud.a build/configuration.c.o build/hub.c.o build/hid.c.o build/keyboard.c.o build/mouse.c.o build/designware20.c.o build/roothub.c.o build/platform.c.o build/broadcom2835.c.o build/armv6.c.o build/usbd.c.o

LdB wrote:
Sat Aug 24, 2019 4:21 am
Try Compiling it in DEBUG mode and lets see what log says

LdB
Posts: 1549
Joined: Wed Dec 07, 2016 2:29 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 4:41 am

Should come out on the serial port terminal.

The problem you are getting into this stuff is very old, we all sort of moved away from this to driver based code but that requires you have thread or task switcher system. Most of the code out there for the Pi USB in baremetal from systems like XV6, XINU, CIRCLE are based around threads/tasks available.

liletian.us
Posts: 43
Joined: Fri Aug 16, 2019 3:57 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Sat Aug 24, 2019 4:47 am

Hi LdB

Thanks for the help. It is a really old stuff, I only wish I can get a working tutorial. :)

Thank you very much for your help.

nothing come out from the screen.

I can not attached the pic,

The screen shows
Welcome to Alex's OS - Everyone's favorite OS

> p


p is the letter that I type in.

:(



BTW, I am using the generated library for the input2 section.

https://www.cl.cam.ac.uk/projects/raspb ... put02.html

LdB wrote:
Sat Aug 24, 2019 4:41 am
Should come out on the serial port terminal.

The problem you are getting into this stuff is very old, we all sort of moved away from this to driver based code but that requires you have thread or task switcher system. Most of the code out there for the Pi USB in baremetal from systems like XV6, XINU, CIRCLE are based around threads/tasks available.

ayziknet
Posts: 2
Joined: Thu Aug 15, 2019 1:17 pm
Location: Lao P.D.R.
Contact: ICQ Website AOL Skype

CSUD Chadderzs Simple USB Driver Source

Mon Aug 26, 2019 6:03 am

My class has just assembled the printrbot simple and when the power is connected, we only get a green light on the mainboard, also we arent seeing anything happen on the computer regarding the USB port. Is is possible I have a bad board? the cable seem to be in the right order. Does this printer do a self test when first powered on ? or do you activate it via the software?

LdB
Posts: 1549
Joined: Wed Dec 07, 2016 2:29 pm

Re: CSUD - Chadderz's Simple USB Driver (Source)

Mon Aug 26, 2019 10:18 am

If your Pi model does not match the compiler setting it will do nothing as the GPIO address is all wrong.
What is on the screen the colour pattern image?
There are numerous threads on the site for "Printrbot Simple" you probably should read all them.

Return to “Bare metal, Assembly language”