43 Commits

Author SHA1 Message Date
Patrick Shickel
9a6081399c [stm32f0cube][bugfix] Fix race which leads to 0-length SETUP transfers
Fixes a race in the STM USB driver which can lead to the device seeing
only 0-length SETUP transfers. The bug ultimately leads to a failed
USB enumeration. The race condition is described in further detail
below.

The current behavior of the IRQ handler for received OUT transfers is
as such:

- Clear RX_CTR bit (at this point, HW sees that SW has acknowledged
previous SETUP/OUT transfer, and the HW will now accept new STATUS
transfers)
- Call out to the client OutStageCallback (nothing significant here)
- Set EP_RX_CNT back to size of max_packet (was previously set to 0 as
we expect to receive 0-length OUT transfer from host. HW uses this
value to limit the amount of data it can receive)
- Set RX_STAT back to VALID (the HW can now receive new STATUS/OUT
transfers)

The important thing to note here is that even before RX_STAT is set to
VALID in the last step, the HW can still receive and process a new
SETUP transfer as long as RX_CTR is cleared (the spec has some detail
about this under section "Control Transfers" on page 867:
https://www.st.com/resource/en/reference_manual/dm00031936.pdf). The
race will occur if we receive a SETUP transfer after clearing RX_CTR
but before adjusting EP_RX_CNT back to max_packet. In this case, the
IRQ handler will run for the newly received SETUP transfer, but the
transfer will have no data associated with it (the driver ends up
using the previous transfer data which was cached).

We can eliminate the race window by waiting to clear RX_CTR only after
we've reset EP_RX_CNT. In this case the HW will ignore any new SETUP
transfers until after the EP_RX_CNT is reset back to the desired
value.
2019-08-07 16:45:25 -07:00
Erik Gilling
4cf2997a04 [stm32f0] Update to STM32Cube v1.10.1. 2019-08-07 11:01:19 -07:00
Travis Geiselbrecht
6cb02526b7 [include][console] split lib/console.h into two
TL;DR most uses of lib/console.h -> lk/console_cmd.h

Move the part that lets a piece of code somewhere in the system to
define a console command from the actual lib/console api to start an
instance of the console. Move in almost every place the user of the
console command definition to the new header, lk/console_cmd.h which is
always in the include path.

Also remove most uses of testing for WITH_LIB_CONSOLE since you can
almost always just safely define it and then let the linker remove it.
2019-07-13 16:56:33 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
Martin Foo
b66bd3e420 Add STM32F429I-DISCO1 support(default serial:USART1). 2019-06-19 18:18:52 -07:00
Travis Geiselbrecht
8dca2206d2 [external][arm][cmsis] save the patch we just applied as a patch file 2019-06-12 14:26:48 -07:00
Travis Geiselbrecht
37918306f8 [external][arm][cmsis] reapply the systick patch to cmsis
SysTick_Config() tries to set the systick priority to max. Comment out
this line since arch/arm/arm-m/arch.c sets the priority to medium to
compete with the rest of the exceptions in the system.
2019-06-12 14:26:48 -07:00
Travis Geiselbrecht
0d58a1a108 [external][arm][cmsis] update to new pristine copy of CMSIS for cortex-m
CMSIS 5.1.0 from the CMSIS 5.5.1 pack

Pristine copy, build broken until next commit.
2019-06-12 14:26:36 -07:00
Travis Geiselbrecht
f98cef7992 [warnings] fix warnings across the entire code base
Fix or squelch all warnings in all code covered by buildall.
2018-12-16 17:33:22 -08:00
Eric Holland
31b8d1d217 [nrf] Support for NRF52840 DK 2018-05-02 14:50:41 -07:00
Todd Eisenberger
e007acc4dc [stm32f0xx] Add support for stm32f070xb
This cleans up handling of a lot of optional components
across f0xx models.
2018-04-17 10:52:14 -07:00
Travis Geiselbrecht
5dea3e1933 [warnings] fix a few warnings introduced with newer version of gcc
Most of the warnings are new, such as needing to mark fallthroughs on
cases explicitly. A few are based on signed vs unsigned comparisons.

Disable one warning that was annoying about comparing null to arguments
marked nonnull.
2018-03-15 14:10:12 -07:00
Travis Geiselbrecht
10bb61326b Merge pull request #146 from littlekernel/pr/nrf52
Pr/nrf52
2016-06-21 09:39:19 -07:00
Travis Geiselbrecht
d52054c87e Merge pull request #143 from konkers/pr/stm32f0-usb
stm32f0xx usb driver
2016-06-21 09:33:24 -07:00
Eric Holland
6388cde233 [nrf52] Platform and sample target support for Nordic NRF52 (cortex-M4) 2016-06-16 16:31:53 -07:00
Eric Holland
1491809fd0 [nrf52] First commit for platform support 2016-06-16 10:41:04 -07:00
Eric Holland
d1c4965dc7 [nordic] move vendor code to external 2016-06-07 10:11:54 -07:00
Erik Gilling
b88985bb2c [stm32f0xx] Add STM32F0xx_HAL_Driver. 2016-06-06 20:55:43 -07:00
Erik Gilling
6c82940c32 [stm32f0xx] Import new CMSIS from STM32Cube_FW_F0_V1.5.0. 2016-06-06 20:55:43 -07:00
Travis Geiselbrecht
2423845505 [merge] merge in cortex-m fpu support changes 2016-03-30 20:28:18 -07:00
Gurjant Kalsi
7d06370f75 [stm32f7][qspi][debug] Add tracing to QSPI driver and STM32f7xx QPSI library. Reset QSPI Controller during init. 2016-03-30 11:16:15 -07:00
Travis Geiselbrecht
f92aad2622 [merge] merge master into the cortex-m fpu working branch 2016-03-28 19:09:40 -07:00
Erik Corry
6d0122b98e [heap] Add API used by Dartino to get arena list 2016-03-23 21:22:39 +01:00
Brian Swetland
0143e97c6e [external][cc13xxware] driver library for TI CC13xx parts
cc13xxware_2_03_00_16456 minus docs, precompiled binaries,
and linker files, as fetched from:

http://www.ti.com/tool/cc13xxware
2016-03-03 14:08:05 -08:00
Erik Gilling
6f277bb95d [stm32f0xx] remove STM32F0xx_StdPeriph_Driver. 2016-03-03 08:21:53 -08:00
cstout
5f050a570a [lib][libm] Add floorf and ceilf
Needed by skia.

R=travisg@gmail.com

Review URL: https://codereview.chromium.org/1734733002 .
2016-02-24 10:17:21 -08:00
Travis Geiselbrecht
dcd82d774e [external] create readme 2016-02-20 11:41:57 -08:00
Travis Geiselbrecht
171d14c751 [arch][arm] move CMSIS into external/ 2016-02-20 11:31:51 -08:00
Travis Geiselbrecht
a3da9e78a4 [lib][cksum] move into external/ 2016-02-20 11:31:51 -08:00
Travis Geiselbrecht
7c412c38d7 [lib][heap] move dlmalloc implementation to external/ 2016-02-20 11:31:51 -08:00
Travis Geiselbrecht
5e14990dbd [lib][libm] move to external/ 2016-02-20 11:31:51 -08:00
Travis Geiselbrecht
c5c59a4897 [lib][aes] move to external/ 2016-02-20 11:31:51 -08:00
Travis Geiselbrecht
e514030336 [lib][mincrypt] move to external/ 2016-02-20 11:31:51 -08:00
Travis Geiselbrecht
8c5d18280d [lib][miniz] move into external/ 2016-02-20 11:31:51 -08:00
Travis Geiselbrecht
cd3a87b962 [lib][lwip] move lwip into external/ 2016-02-20 11:31:51 -08:00
Travis Geiselbrecht
8fa95015b8 [lib][fdt] move to external/ 2016-02-20 11:31:50 -08:00
Travis Geiselbrecht
e905886659 [platform][stm32f2xx] move ST's peripheral driver library into external/ 2016-02-20 11:31:50 -08:00
Travis Geiselbrecht
4bece86daa [platform][stm32f0xx] move ST's peripheral driver library into external/ 2016-02-20 11:31:50 -08:00
Travis Geiselbrecht
5b39a5d889 [platform][stm32f1xx] move ST's peripheral driver library into external/ 2016-02-20 11:31:50 -08:00
Travis Geiselbrecht
8d63a2dcb8 [platform][stm32f4xx] move ST's peripheral driver library into external/ 2016-02-20 11:31:50 -08:00
Travis Geiselbrecht
065785cb03 [platform][stm32f7xx] move the STM32F7xx_HAL_Driver out into external
Functionally equivalent, just rearranged to keep 3rd party code
separate.
2016-02-20 11:31:49 -08:00
Travis Geiselbrecht
b7cb4be62e [platform][stellaris] move TI's driver library into external/ 2016-02-20 11:31:49 -08:00
Travis Geiselbrecht
26effb3988 [platform][lpc15xx] move the lpcopen driver library into external/ 2016-02-20 11:31:49 -08:00