45 Commits

Author SHA1 Message Date
Marc Kleine-Budde
78bafcf07b main: move per channel CAN handling code out of main loop into separate functions
No functional change intended.
2024-01-30 11:48:52 +01:00
ConvertDevice
4dc288d174 feat: add convertdevice xCANFD config info 2023-04-22 09:27:07 -04:00
Chris Wilson
4d7abdf9fd
Add support for additional F072 boards
- DSD TECH SH-C30A: https://www.deshide.com/product-details.html?pid=384242&_t=1671089557
- FYSETC UCAN: https://www.fysetc.com/products/fysetc-ucan-board-based-on-stm32f072-usb-to-can-adapter-support-with-canable-candlelight-klipper-firmware
2023-04-19 22:16:22 -07:00
fenugrec
f07aed4a5b device: add basic (incomplete) G0 file
leftover from last commit. Target doesn't build by default, assuming
broken
2022-12-12 11:27:18 -05:00
fenugrec
2d9d1b302c split device-specific can_init() to separate files 2022-12-12 11:27:18 -05:00
fenugrec
0c23387317 cmake : remove some duplication in add_XYZ_target 2022-12-12 11:09:54 -05:00
ConvertDevice
537c0860c3 feat: change xCAN01 to xCAN 2022-12-11 11:56:15 +08:00
Marc Kleine-Budde
0b52b4eaf9 queue: remove no longer used queue implementation 2022-11-24 10:24:36 +01:00
Marc Kleine-Budde
35d6cb8941 queue: convert to Linux compatible list implementation
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.
2022-11-24 10:24:36 +01:00
Marc Kleine-Budde
0612b5017f cmake: switch from -Os to -O2 optimization
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 ).
2022-11-23 18:20:09 -05:00
Marc Kleine-Budde
9e98f4b49a usbd_gs_can: move struct gs_host_frame msgbuf into USBD_GS_CAN_HandleTypeDef
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.
2022-11-17 13:41:13 -05:00
fenugrec
ac24146664 cmake : generate ldscripts automatically
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.
2022-11-17 12:40:26 -05:00
ConvertDevice
e0e04ea938 ci: add convertdevice-xcan01 hardware support 2022-11-14 10:46:19 -05:00
fenugrec
a0caf93e50 Remove flash-as-eeprom emulation for USER_ID
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.
2022-11-14 10:40:27 -05:00
Ryan Edwards
b24cba3a55 Add config for budgetcan
Update the config.h and CMake to support the budgetcan device which contains the STM32G0B1xK microcontroller.
2022-11-14 10:03:53 -05:00
Ryan Edwards
e8d82ef7ae Add the CMake files to support the STM32G0
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.
2022-11-14 09:15:58 -05:00
Marc Kleine-Budde
439d122d52 cmake: add_link_options(): add LINKER:--print-memory-usage
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%
2022-11-11 00:08:56 +01:00
Marc Kleine-Budde
dcdf5564a4 cmake: add_link_options(): use LINKER: instead of -Xlinker
Using "LINKER:" is a portable way to pass options to the linker tool.

Link: https://cmake.org/cmake/help/v3.25/command/add_link_options.html#handling-compiler-driver-differences
2022-11-11 00:05:26 +01:00
Marc Kleine-Budde
2d11092425 cmake: add_compile_options(), add_link_options(): only 1 option per line and sort them
Only cleanups, no functional change intended.
2022-11-11 00:04:59 +01:00
Ryan Edwards
8f9fa7788c cmake: add µC series letter to TGT*_LIST variables
This is a preparation patch to add support for the STM32G0 series.
2022-11-08 21:26:24 +01:00
Daniel Trevitz
4540120e94 Use consistent whitespace
Use tabs in cmake to match c file formatting

Signed-off-by: Daniel Trevitz <daniel.trevitz@wika.com>
2022-10-05 22:30:06 -04:00
Marc Kleine-Budde
c19f3a17e1 cmake: add -Wstrict-prototypes
Suggested-by: fenugrec <fenugrec@users.sourceforge.net>
Link: https://github.com/candle-usb/candleLight_fw/issues/103
Signed-off-by: Marc Kleine-Budde <mkl@blackshift.org>
2022-08-28 21:47:36 +02:00
ReXT3D
3337447233 Add Makerbase CANable-MKS board support
Configuration for Makerbase CANable-MKS and CANable-MKS Pro boards
2022-07-29 10:23:12 -04:00
fenugrec
2df0d420e9 Simplify BOARD_XYZ macros (no more numeric values)
There is currently no reason to assign a numeric value to each BOARD_*
macro.
Fix #83 GH
2022-01-06 17:54:49 -05:00
fenugrec
6b451da2f0 CMake: clean up -mcpu=XYZ compile flags
also remove duplicate link options for F072 targets
2022-01-06 17:38:41 -05:00
Ricky Lopez
d306798923 Add STM32F4 support
Specifically, the STM32F407VE.
Even more specifically, [this](https://stm32-base.org/boards/STM32F407VET6-STM32-F4VE-V2.0.html) dev board
2022-01-06 12:31:05 -05:00
fenugrec
d66fda39f8 Add git version string to USB config descriptor
There was already provisions for this in the code. Tweaked CMake to
generate version.h automatically every build.
2021-04-06 12:03:13 -04:00
fenugrec
9d00e884c7 cmake : forgot to specify ldscript to linker 2020-12-06 12:51:46 -05:00
Hubert Denkmair
e921aeac87 remove useless linker option 2020-12-06 12:51:46 -05:00
Hubert Denkmair
1712fecf5e enable link-time optimizations 2020-12-06 12:51:46 -05:00
Hubert Denkmair
fef1d397b5 use startup files and linker scripts from LibreUCpp 2020-12-06 12:51:46 -05:00
fenugrec
88ed027020 cmake : clean .bin files, and run dfu-suffix
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.
2020-11-01 15:15:34 -05:00
fenugrec
9cf7eccf3d Add new boardtype : cannette
F042-based, galvanically isolated.
2020-10-30 21:55:27 -04:00
fenugrec
70a18e1a1f Update cmake_minimum_required() version
add_link_options() requires cmake >= 3.13

pointed out by @vondraussen in github PR #39
2019-11-30 12:11:30 -05:00
fenugrec
de943d54f2 un-break cmake (missing ") 2019-11-11 16:20:40 -05:00
Brandon Ros
faa164055a CANAlyze support 2019-11-09 14:26:45 -05:00
fenugrec
079882f000 cmake: make each target a configurable option
by default, everything will be compiled. Each target may be disabled
individually.
2019-11-04 20:26:57 -05:00
fenugrec
ad9351243c cmake: add helpers to generate board targets 2019-11-04 20:20:36 -05:00
fenugrec
9003f5ec1d remove trailing whitespace in CMakeLists.txt too 2019-11-04 19:09:15 -05:00
fenugrec
bb6a14a8fc Fix sp-in-clobberlist error again for gcc9
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.
2019-11-04 18:53:00 -05:00
Hubert Denkmair
e3c7fde27a fix bug #14: candleLight uses F072, cantact F042
was mixed up since a long time (?)
2019-11-03 11:12:18 +01:00
Hubert Denkmair
0352092cda add ASM as cmake language to get init code compiled&linked in 2019-11-02 10:02:24 +01:00
Hubert Denkmair
f24a409d19 add dfu-util flash targets 2019-10-30 20:36:42 +01:00
Hubert Denkmair
f38ddcacf5 generate bin files, show compiled size 2019-10-27 16:09:02 +01:00
Hubert Denkmair
23ebdb8a78 convert to cmake 2019-10-26 16:53:43 +02:00