mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-23 14:44:20 -06:00
build: Use compile_time_request system for init, tasks, and shutdown
Avoid using linker magic to define the init, task, and shutdown functions. Instead, use the compile_time_request system. This simplifies the build and produces more efficient code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ca9756413f
commit
a82e949c00
26 changed files with 82 additions and 127 deletions
|
@ -14,7 +14,7 @@ src-$(CONFIG_AVR_USBSERIAL) += avr/usbserial.c ../lib/pjrc_usb_serial/usb_serial
|
|||
src-$(CONFIG_AVR_SERIAL) += avr/serial.c
|
||||
|
||||
# Suppress broken "misspelled signal handler" warnings on gcc 4.8.1
|
||||
CFLAGS_klipper.o := $(CFLAGS_klipper.o) $(if $(filter 4.8.1, $(shell $(CC) -dumpversion)), -w)
|
||||
CFLAGS_klipper.elf := $(CFLAGS_klipper.elf) $(if $(filter 4.8.1, $(shell $(CC) -dumpversion)), -w)
|
||||
|
||||
# Build the additional hex output file
|
||||
target-y += $(OUT)klipper.elf.hex
|
||||
|
|
|
@ -25,7 +25,7 @@ static uint8_t transmit_pos, transmit_max;
|
|||
|
||||
DECL_CONSTANT(SERIAL_BAUD, CONFIG_SERIAL_BAUD);
|
||||
|
||||
static void
|
||||
void
|
||||
serial_init(void)
|
||||
{
|
||||
if (CONFIG_SERIAL_BAUD_U2X) {
|
||||
|
|
|
@ -71,7 +71,7 @@ timer_repeat_set(uint16_t next)
|
|||
}
|
||||
|
||||
// Reset the timer - clear settings and dispatch next timer immediately
|
||||
static void
|
||||
void
|
||||
timer_reset(void)
|
||||
{
|
||||
uint16_t now = timer_get();
|
||||
|
@ -81,7 +81,7 @@ timer_reset(void)
|
|||
}
|
||||
DECL_SHUTDOWN(timer_reset);
|
||||
|
||||
static void
|
||||
void
|
||||
timer_init(void)
|
||||
{
|
||||
if (CONFIG_AVR_CLKPR != -1 && (uint8_t)CONFIG_AVR_CLKPR != CLKPR) {
|
||||
|
@ -193,7 +193,7 @@ done:
|
|||
|
||||
// Periodic background task that temporarily boosts priority of
|
||||
// timers. This helps prioritize timers when tasks are idling.
|
||||
static void
|
||||
void
|
||||
timer_task(void)
|
||||
{
|
||||
irq_disable();
|
||||
|
|
|
@ -14,7 +14,7 @@ static char receive_buf[USBSERIAL_BUFFER_SIZE];
|
|||
static uint8_t receive_pos;
|
||||
static char transmit_buf[USBSERIAL_BUFFER_SIZE];
|
||||
|
||||
static void
|
||||
void
|
||||
usbserial_init(void)
|
||||
{
|
||||
usb_init();
|
||||
|
|
|
@ -18,7 +18,7 @@ ISR(WDT_vect)
|
|||
shutdown("Watchdog timer!");
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
watchdog_reset(void)
|
||||
{
|
||||
wdt_reset();
|
||||
|
@ -29,7 +29,7 @@ watchdog_reset(void)
|
|||
}
|
||||
DECL_TASK(watchdog_reset);
|
||||
|
||||
static void
|
||||
void
|
||||
watchdog_init(void)
|
||||
{
|
||||
// 0.5s timeout, interrupt and system reset
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue