Convert from the queue implementation to a Linux compatible list
implementation. Get rid of This way we can avoid dynamic memory
allocation altogether.
As the struct gs_host_frame is not placed into the data segment,
requirements for the static memory grows. On the low end processors
the heap reserved in the linker file is too big, resulting in a linker
error. On STM32F042 and STM32F072 set a HEAP size of 0 bytes.
This increases the code size, but even on a STMF042x6 fits into the
flash:
-Os:
| Memory region Used Size Region Size %age Used
| FLASH: 14180 B 32 KB 43.27%
| RAM: 3744 B 6 KB 60.94%
-O2:
| Memory region Used Size Region Size %age Used
| FLASH: 17284 B 32 KB 52.75%
| RAM: 3744 B 6 KB 60.94%
This optimization increases the max TX CAN bus load on a STM32F072
(1 MBit/s, DLC=1) from 77% to 84%.
For completeness:
-O3:
| Memory region Used Size Region Size %age Used
| FLASH: 22568 B 32 KB 68.87%
| RAM: 3744 B 6 KB 60.94%
The max TX CAN bus load is 88%.
This also removes the -fno-move-loop-invariants option which was probably for
some gcc pre-4.9 behaviour (see
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1395077 ).
Place the struct gs_host_frame msgbuf directly into
USBD_GS_CAN_HandleTypeDef. Get rid of another calloc().
This also requires a tweak to heap size in order to fit on the smaller
targets.
99% of the ldscripts is identical, which makes it a pain to maintain.
Now we use cmake 'configure_file()' with a handful of variables to
produce each ldscript from a common template.
There is a pair of USB requests ( GS_USB_BREQ_GET_USER_ID and
_SET_USER_ID) that is not supported by the linux driver, and not used by
any known software :
https://github.com/candle-usb/candleLight_fw/issues/91
Since the firmware returns a unique serial #, there doesn't appear to be
any use case for assigning a user ID. Using a whole flash page for that
purpose can be wasteful on bigger targets .
This removes all the relevant code and adjusts the linker scripts
accordingly.
Add the STM32G0 to the CMake setup. This CMake is specific to the STM32G0B1xK device. Also included the linker file that is required for the make.
Currently G0 targets are disabled by default to keep project buildable
as-is.
This gives a nice memory usage overview during linking:
| Memory region Used Size Region Size %age Used
| FLASH: 15476 B 127 KB 11.90%
| RAM: 4304 B 16 KB 26.27%
| DATA: 4 B 1 KB 0.39%
dfu-util warns when flashing a .bin file that has no "dfu suffix". Now
we use dfu-suffix, if available, to add the dfu suffix; otherwise keep
the original dfu-util command line as a reflash target; fixes#56 GH.
Also add .bin files as BYPRODUCTS so that 'make clean' picks them up
too.
We need to specify -Wno-deprecated at the top level, and not just when
building stm32_HAL because any regular source file that includes in stm32f0xx_hal.h also pulls in those cmsis headers that trigger the deprecation warning.