Commit Graph

29 Commits

Author SHA1 Message Date
Benjamin Freeman f278032e9f fix USB transfer
this ASFv4 USB library change fixes USB transfer.
two transfer-size issues existed:
- on multi-packet transfer if the last packet was less than the
USB transfer packet size, the packet would be received but not
acknowledged
- during normal transfer the packet size of a previous packet set
the size of the current packet, ignoring the actual transfer size

transfer with a combination of partial or full USB single packet,
USB multi-packet, max transfer, and control endpoint sizes was
successfully tested (in bytes): 4, 32, 64, 128, 129, 512, 516,
544, 576, 640, 641, 1024, 1028

Change-Id: Ic4e64168e865362e12e0b76386f964895b8b6c20
2019-02-14 12:48:56 +01:00
Kevin Redon 26037ab23b remove OCTSIM in USB ID
this bootloader is initiated and meant for the sysmo-OCTSIM, but
it can be applied for other SAM E5x/D5x boards.
Thus we remove the OCTSIM name an just use the more generic
bootloader name.

Change-Id: Icc46f0d8b4b649fd00b5c6cea5bad91a93891f14
2019-01-31 18:02:10 +01:00
Kevin Redon 9bd6f6f474 reduce number of endpoints
only endpoint 0 is used, thus there is no need to define more.
this also saves RAM.

Change-Id: I52a5d2d3c3d09ca7dfa165535ccc295bf190841b
2019-01-16 18:41:23 +01:00
Kevin Redon e49a3dbeba add button to force DFU bootloader
Change-Id: I163ab2de0fcbe13532c1992f6b78d49f4cda2d88
2019-01-16 18:41:23 +01:00
Kevin Redon 388dac3f87 start application if valid at boot
if the application is not valid, check and start the bootloader

Change-Id: I323f2b3a1828d3e40a02c7fc755d07009fb43a85
2019-01-16 18:41:23 +01:00
Kevin Redon b0a7dde6a6 add README file
this describes the project, how to compile, and how to flash the
USB DFU bootloader

Change-Id: If884bca373aab10fe74d16f42b79dd6685eeabcf
2019-01-16 18:41:23 +01:00
Kevin Redon dfa652604c use reserved bootloader get application start
the reserved bootloader size is set in the NVM user configuration
and allows to know the application start address (e.g. after the
bootloader)

Change-Id: I9dda27d6401caabb4a6470aa3fe9691f63097136
2019-01-16 18:41:23 +01:00
Kevin Redon 37409534d7 enable flashing by providing real downloaded data length
Change-Id: I6f16170a4b41a70d89954e2c4a841efc67a26786
2019-01-16 18:41:23 +01:00
Kevin Redon 389aca7c2e set USB string to osmocom osmo-ASF4-DFU
Change-Id: I001a7b6f54b3aaab04d55e84cd9ada0daa423805
2019-01-16 18:41:23 +01:00
Kevin Redon 0d59ac02cb add license file
this include the LGPL v2.1 for the DFU stack, ASF for the ASFv4
library, and Apache 2.0 for the CMSIS.

Change-Id: If7b127ddd23bd8c5d158a731d58d425cdf6330f4
2019-01-16 18:41:23 +01:00
Kevin Redon 78aca8fdbc remove unused example code
Change-Id: I205cd02f0c9a55d22bb78e84a88a29afe31224b0
2019-01-16 18:41:23 +01:00
Kevin Redon e9e0d46432 remove unused ARMCC Makefile
Change-Id: I232502798d71c97d0e7b4adf6bb6af3fa0940bd1
2019-01-16 18:41:23 +01:00
Kevin Redon b140e502aa removed unused USB CDC stack
Change-Id: Ib1735ad4add9278be9a1fb730752377de99c4f4b
2019-01-16 18:41:23 +01:00
Kevin Redon 5ba20ae63b implement flashing-side of the DFU state machine
the USB-side state machine currently sets the length to 0,
preventing the actual flashing to be tested

Change-Id: I5ed9cc2a22ed5e41bb59a3ce3f21ab098cec48e7
2019-01-16 18:41:23 +01:00
Kevin Redon dd3269b421 restructure and complete the USB-side DFU state machine
the USB control request are now handled in separate function
depending on the direction (IN or OUT).
download and manifestation are handled.
numerous additional state machine fixes are included.

Change-Id: I5237393c2789fdeddca2182da25ef417a2e71216
2019-01-16 18:41:23 +01:00
Kevin Redon 9e94e7d7ca make USB descriptor available for the two state machines
this is required to know the DFU bmAttributes since they affect
the state machine

Change-Id: Ib3907423bb9e197f53ed4522e8a5789a3d29489e
2019-01-16 18:41:23 +01:00
Kevin Redon 2f8fcbbef6 declare variables so the main loop can read the data to be flashed provided by the USB stack
Change-Id: I092357aad95abef1a781be1ea77944f2ea523dab
2019-01-16 18:41:23 +01:00
Kevin Redon d25509abca add system LED initialisation
Change-Id: I79f1b769fc9dd7e1a972bacf0928ff46988f0e36
2019-01-16 18:40:31 +01:00
Kevin Redon 5c7d9805c2 add code to initialize flash
Change-Id: I2a208abb39a9da8796e2a4bcb803ce32686cb95f
2019-01-16 18:40:31 +01:00
Kevin Redon 9bebe583ae add flash ASF4 driver
this is imported from the Atmel Start website

Change-Id: I5eccb37da64c7def7b99418773d09b6d98664432
2019-01-16 18:40:31 +01:00
Kevin Redon 2257c6c32a add initial DFU class request handling
downloading is not supported yet, but the rest works

Change-Id: I4896d73602bb1b1001c1ce3af9b98e5173b45edf
2019-01-16 18:40:31 +01:00
Kevin Redon c976a85af4 add documentation and fix timeout value
Change-Id: Ia1d6ef4e4a5c9929aefd149c4e3eaf2dfe37fea8
2019-01-16 18:40:31 +01:00
Kevin Redon 74a8e3b615 fix USB enabling
Change-Id: I22cdd77648ac21490909423bf529fb31f30d6af0
2019-01-16 18:40:31 +01:00
Kevin Redon 56739ea049 ignore gdb history file
Change-Id: Ie3acf07ad7404fa3981baf65dab2a3ef416f9938
2019-01-16 18:40:31 +01:00
Kevin Redon efd55db9cc add USB DFU description
uses the USB CDC ACM example code as template to create a USB DFU
description according to USB DFU specification version 1.1

USB DFU stack is under LGPLv2.1 or later license

Change-Id: I7bd6cb46b734ffe8a51f2de7083b4f9e76d385e6
2019-01-16 18:39:41 +01:00
Kevin Redon df28f25276 ignore output files
Change-Id: Ia6c90711a67a9b1cafc7a6cc3b07aa769e8684d0
2019-01-16 18:29:20 +01:00
Max 77643ea6c3 Add git-review config
Change-Id: If28c2f4908f8df96b627fd42b7e122e559d9382a
2019-01-13 13:05:24 +00:00
Harald Welte 9079bc8bcd add contrib/jenkins.sh for build verification
Change-Id: I7ba3a711c3291ca3d61c8064e3e94ab2ae7563e3
2019-01-13 13:40:56 +01:00
Kevin Redon 8476b94ab0 use USB CDC Echo example project
this is the USB CDC Echo example project source code,
for the Microchip SAM E54 Xplained Pro development board,
based on the ATSAME54P20A micro-controller,
exported from the Atmel START website,
using the ASFv4 library.

Change-Id: Ic0e58e42d1a4076bc84a0a8d3509ec4b09a37f46
2019-01-09 15:33:36 +01:00