ChibiOS public support forum for all topics not covered by a specific support forum.
Moderators: RoccoMarco , lbednarz , tfAteba
rambo
Posts: 2 Joined: Sat Sep 06, 2014 3:53 pm
Post
by rambo » Sat Sep 06, 2014 4:02 pm
@MarkusS
I end up in _unhandled_exception for some reason:
Code: Select all
(gdb) break ResetHandler Breakpoint 1 at 0x8001580: file ChibiOS/os/ports/GCC/ARMCMx/crt0.c, line 282. (gdb) cont Continuing. Note: automatically using hardware breakpoints for read-only addresses. Breakpoint 1, ResetHandler () at ChibiOS/os/ports/GCC/ARMCMx/crt0.c:282 282 uint32_t *magic_word = (uint32_t *)(SYMVAL(__ram_end__) - 4); // look at the last word in ram (gdb) step 283 if (*magic_word == 0xDEADBEEF) { (gdb) step 373 } (gdb) step 284 *magic_word = 0; // reset magic flag (gdb) step 285 ((funcp_t) (*(uint32_t *)0x1FFF0004U))(); // jump into boot loader (gdb) step 284 *magic_word = 0; // reset magic flag (gdb) step 285 ((funcp_t) (*(uint32_t *)0x1FFF0004U))(); // jump into boot loader (gdb) step ^C Program received signal SIGINT, Interrupt. _unhandled_exception () at ChibiOS/os/ports/GCC/ARMCMx/STM32F4xx/vectors.c:226 226 void _unhandled_exception(void) { (gdb) bt #0 _unhandled_exception () at ChibiOS/os/ports/GCC/ARMCMx/STM32F4xx/vectors.c:226 #1 <signal handler called> #2 0x00000000 in ?? () #3 0x1fff3d2a in ?? () #4 0x1fff3d2a in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb)
ych
Posts: 45 Joined: Tue Mar 03, 2015 11:38 pm
Has thanked: 17 times
Been thanked: 11 times
Post
by ych » Tue Mar 03, 2015 11:57 pm
MarkusS,
Thank you for your code examples, it helps
.
In the end I improve your example by moving changes which you made in os/ports/GCC/ARMCMx/crt0.c to board.c in __early_init function
Code: Select all
void __early_init(void) { if (MAGIC_DATA_CHECK()) { MAGIC_DATA_CLEAN(); __set_CONTROL(0); __set_MSP((*(uint32_t *)0x1FFF0000U)); // this constant taken from "Device-dependent bootloader parameters" section of AN2606 ((void (*)(void)) (*(uint32_t *)0x1FFF0004U))(); } else { stm32_clock_init(); } }and yes I init stack pointer (as described int video tutorial), because I have issue without it.
Korken
Posts: 270 Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times
Post
by Korken » Thu Mar 26, 2015 8:45 pm
Did anyone get it working without using the magic during startup? I've been trying to jump too the bootloader as well (after all deinit of ChibiOS and clocks), but the chip (STM32F405) just resets instead... Also I've been searching the AN2606 why it resets, but I cannot find an explanation.
alex31
Posts: 445 Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times
Post
by alex31 » Tue Jul 05, 2016 6:58 am
Hello, I occasionally use NVIC_SystemReset and it works for all my projects ... but one. I have a project where NVIC_SystemReset, and even chibios watchdog don't do anything, the MCU (stm32F4, chibios 16.1.5) continue to run after an explicit reset request or watchog counter reaching end. Any idea before i begin the game of difference between the projects where it works and this one who think he is chuck norris ? Alexandre
Giovanni
Site Admin
Posts: 14891 Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times
Post
by Giovanni » Tue Jul 05, 2016 7:10 am
I cannot imagine a way to make a reset-resistant application even if I wish to do so... Giovanni
alex31
Posts: 445 Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times
Post
by alex31 » Tue Jul 05, 2016 8:20 am
got it. I was running on debugger (black magic probe, master branch) , and for an unknown reason, the bmp maintain NRST pin at high level, and this cancel software reset. Alexandre
aGuegu
Posts: 29 Joined: Thu Dec 07, 2017 4:15 am
Has thanked: 1 time
Been thanked: 5 times
Post
by aGuegu » Mon Jan 01, 2018 4:54 pm
For STM32F103, coretx M-3 based chip,
Code: Select all
void softreset(void) { *(uint32_t *)(0xE000ED0CUL) = 0x05FA0000UL | (*(uint32_t *)(0xE000ED0CUL) & 0x0700) | 0x04; }It is mainly the NVIC_SystemReset in core_cm3.h in stdperiph lib. Other cores have this function too.
According to RM0008, this software reset works same as the external NRST pin reset.
sabdulqadir
Posts: 49 Joined: Fri Mar 23, 2018 7:29 pm
Has thanked: 13 times
Been thanked: 4 times
Post
by sabdulqadir » Thu Jun 10, 2021 1:08 am
Giovanni wrote: Hi,
It depends
There is procedure to shutdown entirely the OS, it is described in this article:
http://www.chibios.org/dokuwiki/doku.ph ... os:stop_os If you have threads performing critical operations like writes in EEPROM or Flash then you may want to safely stop the threads then perform the reset.
Giovanni
Can you update the link?
Thanks,
AQ