Move the uuid hash calculation to canbus.c and call canbus_set_uuid()
from src/stm32/chipid.c . This simplifies the low-level canbus
hardware code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Previously the code had canbus_read() which was called from task
context (for admin messages), and canbus_process_data() which was
called from irq context (used for data messages). Change that to a
single canbus_process_data() function that is called from irq context
(used for all messages). This simplifies the low-level hardware
specific canbus code and should make it easier to support other
hardware implementations.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a single CanData global variable to track the canbus state.
ARM micro-controllers generally produce better code when global
variables are in a struct.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When CanBoot is detected set its bypass signature when a
reset is requested.
Add a "try_request_canboot()" method that may be called
from from USB and Canbus bootloader requests.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This adds a command which allows an external script to broadcast a
bootloader request, using a supplied UUID to match the request.
Included is a method to process requests to enter the canboot
bootloader.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rework the micro-controller command protocol so that it supports
direct communication with the serialqueue.c code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Separate out the high-level command processing logic from the
low-level transmission code. Place the high-level code in
src/generic/canbus.c .
This also removes the CAN dependency on serial_irq.c .
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the buffer pointer can't fit in a uint32_t then pass a relative
buffer offset instead. This fixes buffer handling on 64bit linux
mcus.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a helper function to convert from a string buffer passed in the
args[] parameter to an actual pointer. This avoids all the callers
needing to perfrom pointer manipulation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Explicitly disable the SysTick interrupt and explicitly set the stack
pointer, as some bootloaders aren't handling this correctly.
Signed-off-by: Chris Lombardi <clearchris@hotmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the "product id" from the redundant "Klipper firmware" to the
CONFIG_MCU value. For now, only make this change on boards that have
CONFIG_HAVE_CHIPID set.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The main() function has a special meaning to gcc and using it can
result in different code generation. Use armcm_main() to avoid that.
Also, invoke SystemInit() from the board specific armcm_main() code.
This gives the board code more control over board initialization.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename the linker script so the build does not have any conflicts with
the armcm_boot.d dependency file.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add basic ARM Cortex-M C init code and build linker scripts to
src/generic/ code. This can be used to simplify the various ARM board
code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make it clear that the name of the constant being defined is a string.
When the value being defined is also a string, use a new
DECL_CONSTANT_STR() macro.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The ARM CortexM3 (and later) chips almost always have a 32bit timer in
the "Debug and Watch Trace" (DWT) unit which resides within the cpu
core itself. This timer is generally faster to access than timers
located on the chip's peripheral bus. When combined with the standard
ARM SysTick timer it provides a (generally) portable mechanism to
implement Klipper's software timer mechanism. It's generally also
faster than using the vendor specific timers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Increase the amount of time to "busy wait" in the timer dispatch loop
to 2 micro-seconds. This, in practice, causes stepper step and unstep
events to occur within a single hardware interrupt. Doing that helps
stabilize the single active stepper performance benchmarks.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Call usb_read_bulk_out() before calling command_find_and_dispatch() as
this optimizes the common case where each usb packet contains a single
new message block.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Fix travis-ci build failure by forcing the data field of the struct
usb_string_descriptor to be the same type as a 16bit unicode string.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>