Re: Adding Nucleo-F030R8 support to Zephyr - runtime error

Yannis Damigos

Hi Maciej,

On 08/25/2017 03:24 PM, Maciej Dębski wrote:

thank you for your quick responses!

As I wanted to provide more info and debug output, I accidentally found the issue.
This little change in arch/arm/core/cortex_m/prep_c.c caused sys fatal error on my f0 board, even before the stm32f0_init.

Here is the commit: <>

And here are the specific changes causing problem:

diff --git a/arch/arm/core/cortex_m/prep_c.c b/arch/arm/core/cortex_m/prep_c.c
index d23dd8b..1382379 100644
--- a/arch/arm/core/cortex_m/prep_c.c
+++ b/arch/arm/core/cortex_m/prep_c.c
@@ -22,9 +22,20 @@
 #include <linker/linker-defs.h>
 #include <nano_internal.h>
 #include <arch/arm/cortex_m/cmsis.h>
+#include <string.h>
 #ifdef CONFIG_ARMV6_M
-static inline void relocate_vector_table(void) { /* do nothing */ }
+static inline void relocate_vector_table(void)
+#if defined(CONFIG_XIP) && (CONFIG_FLASH_BASE_ADDRESS != 0) || \
+    !defined(CONFIG_XIP) && (CONFIG_SRAM_BASE_ADDRESS != 0)
+       size_t vector_size = (size_t)_vector_end - (size_t)_vector_start;
+       memcpy(VECTOR_ADDRESS, _vector_start, vector_size);
 #elif defined(CONFIG_ARMV7_M)
 #ifdef CONFIG_XIP
 #define VECTOR_ADDRESS ((uintptr_t)&_image_rom_start + \

As I understand it (I may be wrong), the code above does not handle the case of stm32f0 where the main Flash memory is aliased in the boot memory space (0x0000 0000), but still accessible from its original memory space (0x0800 0000).

When I deleted the new body of the relocate_vector_table function (to do nothing as it was) - blinky and hello world started to work fine again.
What should I do now? How to report it properly?
You could provide a patch to address the issue and/or you could report it using github issues.


Join to automatically receive all group messages.