Commit Graph

1238 Commits

Author SHA1 Message Date
Brian Swetland
9a630fcf52 [app][mdebug] change default build configuration
- use swd-m0sub instead of swd-sgpio
- disable lk console
2015-08-03 09:40:03 -07:00
Brian Swetland
965b66a78b [app][mdebug] adjust m0sub firmware a bit
- sample input just after the falling clock edge, since the target
  output changes with the rising clock edge
- bump retry max from 32 to 8192, since stm32f4 targets are observed
  to issue WAITs for 1500+ txns at 4MHz if CPU is not halted
- (disabled) option to report retries back to m4
2015-08-03 09:36:44 -07:00
Brian Swetland
148308cfcd [app][mdebug] avoid getting stuck if IN ACK is lost
If the host receives the IN response packet but the ACK from the host
is lost, we'd be stuck until the next IN, which wouldn't come because
the host does a simple send-request / read-response thing.  Instead,
don't wait for IN txns to complete unless there's already one outstanding.

This allows us to read the next request, at which point the host will
start an IN txn for the response, which will cause the previous IN txn
to complete.
2015-08-02 19:27:47 -07:00
Brian Swetland
70a0631c5f [app][mdebug] alternate swd implementation using M0 sub-processor 2015-08-02 19:23:11 -07:00
Brian Swetland
025da2ff38 [lpc43xx][udc] add write barrier, probably just paranoia 2015-08-02 19:17:54 -07:00
Brian Swetland
c1857484aa [lib][libc] reduce printf processing slightly
Have printf always pass the correct string length to its output callback
(which is easy because it's already got this information at hand), and
save downstream code from having to defensively strlen() the string
passed in the callback.
2015-07-31 19:21:09 -07:00
Brian Swetland
50ff81b387 [debug] remove unused debug print routines
Some code uses dprintf(), but nothing uses dputc(), dputs(), dwrite()
which provide a conditionalized alternative stdio path.  Remove these
as groundwork for further tidying up, organization, and/or unification
of debug printing in lk.
2015-07-31 18:53:59 -07:00
Brian Swetland
0d2e2651e6 [lpc43xx][udc] correctly set the interface number 2015-07-31 17:48:20 -07:00
Brian Swetland
c6db623a8a [dev][udc] support multiple gadgets (one interface per gadget)
Also move more of the generic udc glue into udc-common.c
2015-07-31 16:07:22 -07:00
Brian Swetland
7423f264d4 [app][lpcboot] support flashing bl & app, launching app 2015-07-31 13:21:49 -07:00
Brian Swetland
1da3bd7963 [platform][lpc43xx] yield during dgetc 2015-07-30 19:57:26 -07:00
Brian Swetland
855ac68ec0 [app][mdebug] don't poll for usb txn completion 2015-07-30 15:13:46 -07:00
Brian Swetland
9ad76f486a [app][mdebug] make setclock work 2015-07-30 10:21:12 -07:00
Brian Swetland
a35aec6349 [app][mdebug] project for mdebug on lpclink2 board 2015-07-30 10:02:14 -07:00
Brian Swetland
ba29c3452e [app][mdebug] firmware for m3debug/debugger
- supports lpc43xx/lpclink2
- some performance issues to shake out yet
- client side debugger: https://github.com/swetland/m3dev
2015-07-30 10:00:12 -07:00
Brian Swetland
cb8d867a4b [lpc43xx][sgpio] header for serial gpio peripheral 2015-07-30 09:59:27 -07:00
Brian Swetland
7ec6f8914e [lpc43xx][gpio] fix typo in header 2015-07-30 09:59:09 -07:00
Brian Swetland
54cfc1a645 [lpc43xx][gpio] implement basic gpio api, clean up header a bit
It's hard to fully unify this without some table mapping GPIOs to PINs.
2015-07-27 12:53:32 -07:00
Brian Swetland
0363aa6335 [app][lpcboot] microbootloader for nxp m3/m4 devices
- compatible with m3dev lpcboot tool
- supports lpc43xx with external spi flash right now
- suitable for acting as a second stage flash agent after rom dfu download
2015-07-26 23:05:41 -07:00
Brian Swetland
a7abcb473a [target][lpclink2] lpclink2 debugger / development board 2015-07-26 23:04:37 -07:00
Brian Swetland
2a2e0b197c [include] add readb()/writeb() to reg.h 2015-07-26 22:47:27 -07:00
Brian Swetland
4feb0286b4 [platform][lpc43xx] option for using bootloader clock config 2015-07-26 21:57:44 -07:00
Brian Swetland
b83ca46590 [lpc43xx][udc] some basic locking to avoid badness
The big bit of unfinished work is supporting multiple queue'd requests
and queueing a request against an endpoint where requests are in progress
(neither work yet, both will result in things getting messed up).
2015-07-26 14:43:33 -07:00
Brian Swetland
a17c1b3a89 [app][udctest] exercise the udc api 2015-07-26 12:28:10 -07:00
Brian Swetland
945ae49780 [platform][lpc43xx][udc] USB Device Controller Driver
This borrows liberally from the old LK MSM72xx UDC driver that existed
back in 2008.  Turns out the MSM72xx and LPC43xx use the same UDC IP
block.

Code has been tidied up a bit, uses a hw header I threw together
before finding the old driver, and some udc common code has been
broken out into a separate file, but not yet a library.

Still needs some locking code and other cleanup, but enumeration
and bulk transfers are working.
2015-07-26 12:28:10 -07:00
Brian Swetland
5747ede097 [target][lpc4337xpresso] absorb the 'generic' 43xx project 2015-07-26 12:28:10 -07:00
Brian Swetland
65aceadb1e [platform][lpc43xx] update irq defs 2015-07-26 12:28:10 -07:00
Brian Swetland
af1368b199 [lib][udc] dust off and clean up the long-dormant UDC interface 2015-07-26 12:28:10 -07:00
Will Lee
06cfce0adf [platform][stm32f4xx] internal flash support for bio layer 2015-07-16 18:21:56 -07:00
Brian Swetland
52dc703a5e [platform][lpc43xx] more clock setup fiddling 2015-07-14 23:34:39 -07:00
Shinya Suzuki
d953d335e7 [platform][stm32f4xx] support uart baud rate change 2015-07-14 14:24:13 -07:00
Brian Swetland
76749b16d1 [platform][lpc43xx] pass correct frequency to arm_cm_systick_init() 2015-07-13 00:21:24 -07:00
Brian Swetland
08492fa540 [platform][lpc43xx] spifi serial flash controller registers 2015-07-13 00:19:14 -07:00
Brian Swetland
d68991fd41 [platform][lpc43xx] configure for 192MHz PLL1 and BASE_M4_CLK
Max is 204MHz, but 192 divides better for UARTs, etc.
2015-07-13 00:18:04 -07:00
Brian Swetland
ab23ec112a [platform][lpc43xx] more clock registers 2015-07-13 00:15:46 -07:00
Brian Swetland
5ce67dc53c [platform][lpc43xx] generate lk.bin.sign with lpc rom checksum 2015-07-12 00:52:33 -07:00
Will Lee
c4ab10c760 [platform][stm32f4xx] disable platform vector table relocation
This can interfere with LK's management of the vector table.
2015-07-09 17:46:03 -07:00
Brian Swetland
e21e81f24d [arch][arm-m] debugger info
Use the reserved cortex-m vectors 8 and 9 for a magic cookie and
pointer to a debugger info structure.  This structure contains
pointers to the threadlist, the current thread pointer, and
offsets to important members of the thread structure.  With
this information, an attached debugger can walk the threadlist
and obtain state, name, registers, etc for each thread.

Use global define WITH_DEBUGGER_INFO to enable this.
2015-07-09 17:39:25 -07:00
Will Lee
141e4ffaa5 [kernel] call static constructors after heap init
Avoids badness when a constructor needs to malloc() something, etc.
2015-07-07 15:56:45 -07:00
Brian Swetland
eea18f45cc [platform][lpc43xx] usb device controller register/structure info 2015-07-06 00:01:00 -07:00
Brian Swetland
b736d68903 [platform][lpc43xx] support some faster debug uart baudrates
TARGET_DEBUG_BAUDRATE may be 115200, 1000000, 2000000, or 3000000
2015-07-05 23:10:55 -07:00
Brian Swetland
45a6034cf6 [platform][lpc43xx] hook up reboot 2015-07-05 05:45:02 -07:00
Brian Swetland
3e3036d0c2 [platform][lpc43xx] hook up debug uart
For the moment, just a trivial implementation in debug.c.
To be replaced with a standard lk uart "driver" later on.
2015-07-05 05:44:54 -07:00
Brian Swetland
c1f044266f [platform][lpc43xx] add register definitions for some core bits 2015-07-05 05:44:54 -07:00
Brian Swetland
39afbc9668 [platform][lpc43xxx] minimal skeleton platform, target, and project
Just enough to compile cleanly.  Not much platform-specific information
besides the IRQ numbers just yet.
2015-07-05 05:44:54 -07:00
Brian Swetland
818352d4a3 [platform][stm32f4xx] minor cleanup 2015-07-02 15:19:14 -07:00
Brian Swetland
05636f5eb2 [platform][stm32f4xx] allow per-uart baudrate and rxbuf size configuration 2015-07-02 15:14:38 -07:00
Brian Swetland
cbc6bb96fd [target][stm32f4-discovery] run system at 168MHz
SYSCLK 168000000
HCLK   168000000
PCLK1  42000000
PCLK2  84000000
2015-07-01 22:47:40 -07:00
Brian Swetland
31d66a7b3a [platform][stm32f4xx] fix warning in uart.c 2015-07-01 22:47:23 -07:00
Brian Swetland
12fdd82e03 [platform][stm32f4xx] fix uart_getc() to work properly if wait==1
return a negative value if no characters are available
2015-07-01 19:47:35 -07:00