armcm_reset: Add a new helper file defining command_reset()
Add a generic ARM Cortex-M implementation of the "reset" command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
80e17b1e53
commit
1c6a8267f9
|
@ -19,8 +19,8 @@ CFLAGS_klipper.elf += -T $(OUT)src/generic/armcm_link.ld
|
||||||
$(OUT)klipper.elf: $(OUT)src/generic/armcm_link.ld
|
$(OUT)klipper.elf: $(OUT)src/generic/armcm_link.ld
|
||||||
|
|
||||||
# Add source files
|
# Add source files
|
||||||
src-y += atsamd/main.c atsamd/gpio.c
|
src-y += atsamd/main.c atsamd/gpio.c generic/crc16_ccitt.c
|
||||||
src-y += generic/armcm_boot.c generic/armcm_irq.c generic/crc16_ccitt.c
|
src-y += generic/armcm_boot.c generic/armcm_irq.c generic/armcm_reset.c
|
||||||
src-$(CONFIG_USBSERIAL) += atsamd/usbserial.c generic/usb_cdc.c
|
src-$(CONFIG_USBSERIAL) += atsamd/usbserial.c generic/usb_cdc.c
|
||||||
src-$(CONFIG_SERIAL) += atsamd/serial.c generic/serial_irq.c
|
src-$(CONFIG_SERIAL) += atsamd/serial.c generic/serial_irq.c
|
||||||
src-$(CONFIG_HAVE_GPIO_ADC) += atsamd/adc.c
|
src-$(CONFIG_HAVE_GPIO_ADC) += atsamd/adc.c
|
||||||
|
|
|
@ -10,13 +10,6 @@
|
||||||
|
|
||||||
DECL_CONSTANT_STR("MCU", CONFIG_MCU);
|
DECL_CONSTANT_STR("MCU", CONFIG_MCU);
|
||||||
|
|
||||||
void
|
|
||||||
command_reset(uint32_t *args)
|
|
||||||
{
|
|
||||||
NVIC_SystemReset();
|
|
||||||
}
|
|
||||||
DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");
|
|
||||||
|
|
||||||
// Main entry point
|
// Main entry point
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Generic reset command handler for ARM Cortex-M boards
|
||||||
|
//
|
||||||
|
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
||||||
|
//
|
||||||
|
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
|
|
||||||
|
#include "board/internal.h" // NVIC_SystemReset
|
||||||
|
#include "command.h" // DECL_COMMAND_FLAGS
|
||||||
|
|
||||||
|
void
|
||||||
|
command_reset(uint32_t *args)
|
||||||
|
{
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");
|
|
@ -14,7 +14,7 @@ $(OUT)klipper.elf: $(OUT)src/generic/armcm_link.ld
|
||||||
# Add source files
|
# Add source files
|
||||||
src-y += lpc176x/main.c lpc176x/gpio.c
|
src-y += lpc176x/main.c lpc176x/gpio.c
|
||||||
src-y += generic/armcm_boot.c generic/armcm_irq.c generic/armcm_timer.c
|
src-y += generic/armcm_boot.c generic/armcm_irq.c generic/armcm_timer.c
|
||||||
src-y += generic/crc16_ccitt.c
|
src-y += generic/armcm_reset.c generic/crc16_ccitt.c
|
||||||
src-y += ../lib/lpc176x/device/system_LPC17xx.c
|
src-y += ../lib/lpc176x/device/system_LPC17xx.c
|
||||||
src-$(CONFIG_HAVE_GPIO_ADC) += lpc176x/adc.c
|
src-$(CONFIG_HAVE_GPIO_ADC) += lpc176x/adc.c
|
||||||
src-$(CONFIG_HAVE_GPIO_I2C) += lpc176x/i2c.c
|
src-$(CONFIG_HAVE_GPIO_I2C) += lpc176x/i2c.c
|
||||||
|
|
|
@ -60,13 +60,6 @@ enable_pclock(uint32_t pclk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
command_reset(uint32_t *args)
|
|
||||||
{
|
|
||||||
NVIC_SystemReset();
|
|
||||||
}
|
|
||||||
DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");
|
|
||||||
|
|
||||||
// Main entry point
|
// Main entry point
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
|
|
|
@ -20,8 +20,9 @@ CFLAGS_klipper.elf += -T $(OUT)src/generic/armcm_link.ld
|
||||||
$(OUT)klipper.elf: $(OUT)src/generic/armcm_link.ld
|
$(OUT)klipper.elf: $(OUT)src/generic/armcm_link.ld
|
||||||
|
|
||||||
# Add source files
|
# Add source files
|
||||||
src-y += stm32/main.c stm32/watchdog.c stm32/gpio.c generic/armcm_boot.c
|
src-y += stm32/main.c stm32/watchdog.c stm32/gpio.c generic/crc16_ccitt.c
|
||||||
src-y += generic/crc16_ccitt.c generic/armcm_irq.c generic/armcm_timer.c
|
src-y += generic/armcm_boot.c generic/armcm_irq.c generic/armcm_timer.c
|
||||||
|
src-y += generic/armcm_reset.c
|
||||||
src-$(CONFIG_MACH_STM32F1) += ../lib/stm32f1/system_stm32f1xx.c
|
src-$(CONFIG_MACH_STM32F1) += ../lib/stm32f1/system_stm32f1xx.c
|
||||||
src-$(CONFIG_MACH_STM32F1) += stm32/stm32f1.c
|
src-$(CONFIG_MACH_STM32F1) += stm32/stm32f1.c
|
||||||
src-$(CONFIG_MACH_STM32F4) += ../lib/stm32f4/system_stm32f4xx.c
|
src-$(CONFIG_MACH_STM32F4) += ../lib/stm32f4/system_stm32f4xx.c
|
||||||
|
|
|
@ -11,13 +11,6 @@
|
||||||
|
|
||||||
DECL_CONSTANT_STR("MCU", CONFIG_MCU);
|
DECL_CONSTANT_STR("MCU", CONFIG_MCU);
|
||||||
|
|
||||||
void
|
|
||||||
command_reset(uint32_t *args)
|
|
||||||
{
|
|
||||||
NVIC_SystemReset();
|
|
||||||
}
|
|
||||||
DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");
|
|
||||||
|
|
||||||
// Main entry point
|
// Main entry point
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
|
|
Loading…
Reference in New Issue