-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32F0 benchmarks #1462
STM32F0 benchmarks #1462
Conversation
Signed-off-by: Eugene Krashtan <[email protected]>
4dd7408
to
f2c7df6
Compare
Thanks. FYI, the reason for the poor performance (relative to the similar SAMD21 chip) is due to the lack of -fwhole-program. gcc just doesn't do a good job of inlining without that flag. -Kevin |
@KevinOConnor Unfortunately in my GCC version I can use either -fwhole-program or -fno-use-linker-plugin, but not both :( |
Can you describe the problem you are seeing? It compiles fine for me with the following changes: diff --git a/src/stm32f0/Makefile b/src/stm32f0/Makefile
index 16136b52..093be66f 100644
--- a/src/stm32f0/Makefile
+++ b/src/stm32f0/Makefile
@@ -9,9 +9,6 @@ dirs-y += src/stm32f0 src/generic
dirs-y += lib/cmsis-stm32f0/source
dirs-y += lib/hal-stm32f0/source
-CFLAGS = -I$(OUT) -Isrc -I$(OUT)board-generic/ -std=gnu11 -O2 -MD \
- -Wall -Wold-style-definition $(call cc-option,$(CC),-Wtype-limits,) \
- -ffunction-sections -fdata-sections
CFLAGS += -flto -fno-use-linker-plugin
CFLAGS += -mthumb -mcpu=cortex-m0 -g3
CFLAGS += -Ilib/cmsis-core -Iout/board
@@ -60,7 +57,7 @@ $(OUT)klipper.bin: $(OUT)klipper.elf
$(OUT)klipper.hex: $(OUT)klipper.elf
@echo " Creating hex file $@"
$(Q)$(OBJCOPY) -O ihex $< $@
-
+
flash: $(OUT)klipper.hex
@echo " Flashing hex file $<"
$(Q)$(STLINK) --format ihex --reset write $<
diff --git a/src/stm32f0/can.c b/src/stm32f0/can.c
index 6ce9aad4..cc0c0bf1 100644
--- a/src/stm32f0/can.c
+++ b/src/stm32f0/can.c
@@ -149,7 +149,7 @@ void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *h)
* @brief This function handles HDMI-CEC and CAN global interrupts /
* HDMI-CEC wake-up interrupt through EXTI line 27.
*/
-void CEC_CAN_IRQHandler(void)
+void __visible CEC_CAN_IRQHandler(void)
{
HAL_CAN_IRQHandler(&hcan);
}
diff --git a/src/stm32f0/main.c b/src/stm32f0/main.c
index 89d8a6e5..da1f129c 100644
--- a/src/stm32f0/main.c
+++ b/src/stm32f0/main.c
@@ -149,7 +149,7 @@ void HAL_MspInit(void)
* on Cortex-M0 chips
****************************************************************/
-void hard_fault_handler_c(unsigned long *hardfault_args){
+void __visible hard_fault_handler_c(unsigned long *hardfault_args){
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
volatile unsigned long stacked_r0 ;
diff --git a/src/stm32f0/serial.c b/src/stm32f0/serial.c
index 103a0d70..7c3ba892 100644
--- a/src/stm32f0/serial.c
+++ b/src/stm32f0/serial.c
@@ -15,7 +15,7 @@
UART_HandleTypeDef huart2;
static uint8_t rxbuf, txbuf;
-void USART2_IRQHandler(void)
+void __visible USART2_IRQHandler(void)
{
HAL_UART_IRQHandler(&huart2);
}
diff --git a/src/stm32f0/timer.c b/src/stm32f0/timer.c
index 0b285d4e..f51e69ba 100644
--- a/src/stm32f0/timer.c
+++ b/src/stm32f0/timer.c
@@ -77,7 +77,7 @@ SysTick_Handler(void)
irq_enable();
}
-void TIM2_IRQHandler(void)
+void __visible TIM2_IRQHandler(void)
{
if(TIM2->SR & TIM_SR_UIF) {
TIM2->SR &= ~TIM_SR_UIF; // clear UIF flag We use -fwhole-program on a number of different gcc versions and on a number of different ARM targets, so I think it would be worthwhile to track down what the root cause of the problem is. -Kevin |
@KevinOConnor Yes, you are right, I forgot about __visible |
BTW, is the code in lib/cmsis-stm32f0/ the pristine code from st? I noticed that only startup_stm32f042x6.s has a reference to hard_fault_handler_c - that's certainly odd. -Kevin |
@KevinOConnor yes, I put this change for debugging purposes. Probably we can drop this change as everything working, I hope we don't need huge code changes in future. |
I don't have the original st code, so I can't remove the changes. I'd like the code in the lib/ directory to have accurate documentation on where the code originates from. So, please submit a pull request returning the code in the lib/ directory to the pristine code from st, or update the lib/README with a list of all the changes in the code (for example, take a look at how the changes to the lib/sam4e/ directory are documented). Thanks, |
Signed-off-by: Eugene Krashtan <[email protected]>
Signed-off-by: Eugene Krashtan <[email protected]>
Pretty strange results for more than one stepper, but I've run tests few times and results the same.