diff --git a/grbl/system.c b/grbl/system.c index d1665ff..491dfdf 100644 --- a/grbl/system.c +++ b/grbl/system.c @@ -351,57 +351,57 @@ uint8_t system_check_travel_limits(float *target) // Special handlers for setting and clearing Grbl's real-time execution flags. void system_set_exec_state_flag(uint8_t mask) { - uint8_t sreg = SREG; - cli(); + uint8_t en = __get_PRIMASK(); + __disable_irq(); sys_rt_exec_state |= (mask); - SREG = sreg; + if(en) __enable_irq(); } void system_clear_exec_state_flag(uint8_t mask) { - uint8_t sreg = SREG; - cli(); + uint8_t en = __get_PRIMASK(); + __disable_irq(); sys_rt_exec_state &= ~(mask); - SREG = sreg; + if(en) __enable_irq(); } void system_set_exec_alarm(uint8_t code) { - uint8_t sreg = SREG; - cli(); + uint8_t en = __get_PRIMASK(); + __disable_irq(); sys_rt_exec_alarm = code; - SREG = sreg; + if(en) __enable_irq(); } void system_clear_exec_alarm() { - uint8_t sreg = SREG; - cli(); + uint8_t en = __get_PRIMASK(); + __disable_irq(); sys_rt_exec_alarm = 0; - SREG = sreg; + if(en) __enable_irq(); } void system_set_exec_motion_override_flag(uint8_t mask) { - uint8_t sreg = SREG; - cli(); + uint8_t en = __get_PRIMASK(); + __disable_irq(); sys_rt_exec_motion_override |= (mask); - SREG = sreg; + if(en) __enable_irq(); } void system_set_exec_accessory_override_flag(uint8_t mask) { - uint8_t sreg = SREG; - cli(); + uint8_t en = __get_PRIMASK(); + __disable_irq(); sys_rt_exec_accessory_override |= (mask); - SREG = sreg; + if(en) __enable_irq(); } void system_clear_exec_motion_overrides() { - uint8_t sreg = SREG; - cli(); + uint8_t en = __get_PRIMASK(); + __disable_irq(); sys_rt_exec_motion_override = 0; - SREG = sreg; + if(en) __enable_irq(); } void system_clear_exec_accessory_overrides() { - uint8_t sreg = SREG; - cli(); + uint8_t en = __get_PRIMASK(); + __disable_irq(); sys_rt_exec_accessory_override = 0; - SREG = sreg; + if(en) __enable_irq(); } diff --git a/smoother/Makefile b/smoother/Makefile index c9602db..e0f56df 100644 --- a/smoother/Makefile +++ b/smoother/Makefile @@ -26,6 +26,8 @@ Makefile : ; clean : $(call RM,$(OBJDIR)) +flash: all + else VPATH = .. @@ -71,7 +73,7 @@ SIZE = $(GCC_BIN)arm-none-eabi-size CPU = -mcpu=cortex-m3 -mthumb CC_FLAGS = -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -Os -std=gnu99 -DDEVICE_ERROR_PATTERN=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DTARGET_NXP -DTARGET_LPC176X -DDEVICE_PORTIN=1 -DDEVICE_RTC=1 -DTOOLCHAIN_object -D__CMSIS_RTOS -DTOOLCHAIN_GCC -DDEVICE_CAN=1 -DTARGET_LIKE_CORTEX_M3 -DTARGET_CORTEX_M -DARM_MATH_CM3 -DDEVICE_ANALOGOUT=1 -DTARGET_UVISOR_UNSUPPORTED -DTARGET_M3 -DDEVICE_PWMOUT=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_I2C=1 -DMBED_BUILD_TIMESTAMP=1483402623.08 -D__CORTEX_M3 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_LPC1768 -DTARGET_RELEASE -DDEVICE_PORTINOUT=1 -DDEVICE_SERIAL_FC=1 -DTARGET_MBED_LPC1768 -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DDEVICE_ETHERNET=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_SEMIHOST=1 -DDEVICE_DEBUG_AWARENESS=1 -DDEVICE_LOCALFILESYSTEM=1 -include mbed_config.h -MMD -MP -CPPC_FLAGS = -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -Os -std=gnu++98 -fno-rtti -Wvla -DDEVICE_ERROR_PATTERN=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DTARGET_NXP -DTARGET_LPC176X -DDEVICE_PORTIN=1 -DDEVICE_RTC=1 -DTOOLCHAIN_object -D__CMSIS_RTOS -DTOOLCHAIN_GCC -DDEVICE_CAN=1 -DTARGET_LIKE_CORTEX_M3 -DTARGET_CORTEX_M -DARM_MATH_CM3 -DDEVICE_ANALOGOUT=1 -DTARGET_UVISOR_UNSUPPORTED -DTARGET_M3 -DDEVICE_PWMOUT=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_I2C=1 -DMBED_BUILD_TIMESTAMP=1483402623.08 -D__CORTEX_M3 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_LPC1768 -DTARGET_RELEASE -DDEVICE_PORTINOUT=1 -DDEVICE_SERIAL_FC=1 -DTARGET_MBED_LPC1768 -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DDEVICE_ETHERNET=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_SEMIHOST=1 -DDEVICE_DEBUG_AWARENESS=1 -DDEVICE_LOCALFILESYSTEM=1 -include mbed_config.h -MMD -MP +CPPC_FLAGS = -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -Os -std=gnu++14 -fno-rtti -Wvla -DDEVICE_ERROR_PATTERN=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DTARGET_NXP -DTARGET_LPC176X -DDEVICE_PORTIN=1 -DDEVICE_RTC=1 -DTOOLCHAIN_object -D__CMSIS_RTOS -DTOOLCHAIN_GCC -DDEVICE_CAN=1 -DTARGET_LIKE_CORTEX_M3 -DTARGET_CORTEX_M -DARM_MATH_CM3 -DDEVICE_ANALOGOUT=1 -DTARGET_UVISOR_UNSUPPORTED -DTARGET_M3 -DDEVICE_PWMOUT=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_I2C=1 -DMBED_BUILD_TIMESTAMP=1483402623.08 -D__CORTEX_M3 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_LPC1768 -DTARGET_RELEASE -DDEVICE_PORTINOUT=1 -DDEVICE_SERIAL_FC=1 -DTARGET_MBED_LPC1768 -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DDEVICE_ETHERNET=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_SEMIHOST=1 -DDEVICE_DEBUG_AWARENESS=1 -DDEVICE_LOCALFILESYSTEM=1 -include mbed_config.h -MMD -MP ASM_FLAGS = -x assembler-with-cpp -D__CMSIS_RTOS -D__MBED_CMSIS_RTOS_CM -D__CORTEX_M3 -DARM_MATH_CM3 -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -Os CC_SYMBOLS = -DDEVICE_ERROR_PATTERN=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DTARGET_NXP -DTARGET_LPC176X -DDEVICE_PORTIN=1 -DDEVICE_RTC=1 -DTOOLCHAIN_object -D__CMSIS_RTOS -DTOOLCHAIN_GCC -DDEVICE_CAN=1 -DTARGET_LIKE_CORTEX_M3 -DTARGET_CORTEX_M -DARM_MATH_CM3 -DDEVICE_ANALOGOUT=1 -DTARGET_UVISOR_UNSUPPORTED -DTARGET_M3 -DDEVICE_PWMOUT=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_I2C=1 -DMBED_BUILD_TIMESTAMP=1483402623.08 -D__CORTEX_M3 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_LPC1768 -DTARGET_RELEASE -DDEVICE_PORTINOUT=1 -DDEVICE_SERIAL_FC=1 -DTARGET_MBED_LPC1768 -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DDEVICE_ETHERNET=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_SEMIHOST=1 -DDEVICE_DEBUG_AWARENESS=1 -DDEVICE_LOCALFILESYSTEM=1 @@ -133,5 +135,7 @@ size: $(PROJECT).elf DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d) -include $(DEPS) +flash: all + fm COM(7, 115200) DEVICE(LPC1769, 0.000000, 0) HARDWARE(BOOTEXEC, 50, 100) ERASEUSED(mbed_blinky.hex, PROTECTISP) HEXFILE(mbed_blinky.hex, NOCHECKSUMS, NOFILL, PROTECTISP) endif