mynewt-core icon indicating copy to clipboard operation
mynewt-core copied to clipboard

Bootloader crashes on 32F746GDISCOVERY board

Open vs-pp opened this issue 6 months ago • 1 comments

Project info

macpro2: ~/work/pp/mynewt/newt_ws/newt_ws1_13 : more project.yml 
...
project.name: "my_project"

project.repositories:
    - apache-mynewt-core

# Use github's distribution mechanism for core ASF libraries.
# This provides mirroring automatically for us.
#
repository.apache-mynewt-core:
    type: github
    vers: 1.13.0
    user: apache
    repo: mynewt-core

Here is target configuration

macpro2: ~/work/pp/mynewt/newt_ws/newt_ws1_13 : newt target show
targets/my_blinky_sim
    app=apps/blinky
    bsp=@apache-mynewt-core/hw/bsp/native
    build_profile=debug
targets/stm32f4disc_blinky
    app=apps/blinky
    bsp=@apache-mynewt-core/hw/bsp/stm32f411discovery
    build_profile=debug
targets/stm32f4disc_boot
    app=@mcuboot/boot/mynewt
    bsp=@apache-mynewt-core/hw/bsp/stm32f411discovery
    build_profile=optimized
targets/stm32f7disc_blinky
    app=apps/blinky
    bsp=@apache-mynewt-core/hw/bsp/stm32f7discovery
    build_profile=debug
targets/stm32f7disc_boot
    app=@mcuboot/boot/mynewt
    bsp=@apache-mynewt-core/hw/bsp/stm32f7discovery
    build_profile=optimized

I am loading using below and it is crashing in the bootloader

newt load stm32f7disc_boot
newt load stm32f7disc_blinky

My yaml files

macpro2: ~/work/pp/mynewt/newt_ws/newt_ws1_13/targets/stm32f7disc_boot : cat pkg.yml 
pkg.name: targets/stm32f7disc_boot
pkg.type: target
pkg.description: 
pkg.author: 
pkg.homepage: 

macpro2: ~/work/pp/mynewt/newt_ws/newt_ws1_13/targets/stm32f7disc_boot : cat syscfg.yml 
macpro2: ~/work/pp/mynewt/newt_ws/newt_ws1_13/targets/stm32f7disc_boot : cat target.yml 
target.app: "@mcuboot/boot/mynewt"
target.bsp: "@apache-mynewt-core/hw/bsp/stm32f7discovery"
target.build_profile: optimized

Debug info

 newt debug stm32f7disc_boot
[/Users/venkat/work/pp/mynewt/newt_ws/newt_ws1_13/repos/apache-mynewt-core/hw/bsp/stm32f7discovery/stm32f7discovery_debug.sh /Users/venkat/work/pp/mynewt/newt_ws/newt_ws1_13/repos/apache-mynewt-core/hw/bsp/stm32f7discovery /Users/venkat/work/pp/mynewt/newt_ws/newt_ws1_13/bin/targets/stm32f7disc_boot/app/@mcuboot/boot/mynewt/mynewt]
; stm32f7x.cpu configure -event gdb-detach {if {[stm32f7x.cpu curstate] eq "halted"} resume;shutdown}
GNU gdb (GNU Arm Embedded Toolchain 10.3-2021.10) 10.2.90.20210621-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /Users/venkat/work/pp/mynewt/newt_ws/newt_ws1_13/bin/targets/stm32f7disc_boot/app/@mcuboot/boot/mynewt/mynewt.elf...
Default_HardFault_Handler () at repos/apache-mynewt-core/boot/startup/src/interrupts.c:39
39	    while(1);
(gdb) monitor reset halt
Unable to match requested speed 2000 kHz, using 1800 kHz
Unable to match requested speed 2000 kHz, using 1800 kHz
[stm32f7x.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080001c8 msp: 0x2005c000
(gdb) b SystemClock_Config
Breakpoint 1 at 0x80018a0: file repos/apache-mynewt-core/hw/mcu/stm/stm32f7xx/src/clock_stm32f7xx.c, line 48.
Note: automatically using hardware breakpoints for read-only addresses.
(gdb) c
Continuing.

Breakpoint 1, SystemClock_Config () at repos/apache-mynewt-core/hw/mcu/stm/stm32f7xx/src/clock_stm32f7xx.c:48
48	    RCC_OscInitTypeDef osc_init = {0};
(gdb) p &osc_init
$1 = (RCC_OscInitTypeDef *) 0x2005bfc0
(gdb) disassemble 
Dump of assembler code for function SystemClock_Config:
=> 0x080018a0 <+0>:	push	{r4, lr}
   0x080018a2 <+2>:	sub	sp, #80	; 0x50
   0x080018a4 <+4>:	movs	r2, #48	; 0x30
   0x080018a6 <+6>:	movs	r1, #0
   0x080018a8 <+8>:	add	r0, sp, #32
   0x080018aa <+10>:	bl	0x8001cd4 <memset>
   0x080018ae <+14>:	movs	r2, #20
   0x080018b0 <+16>:	movs	r1, #0
   0x080018b2 <+18>:	add	r0, sp, #12
   0x080018b4 <+20>:	bl	0x8001cd4 <memset>
   0x080018b8 <+24>:	dsb	sy
   0x080018bc <+28>:	isb	sy
   0x080018c0 <+32>:	ldr	r3, [pc, #196]	; (0x8001988 <SystemClock_Config+232>)
   0x080018c2 <+34>:	movs	r1, #0
   0x080018c4 <+36>:	str.w	r1, [r3, #592]	; 0x250
   0x080018c8 <+40>:	dsb	sy
   0x080018cc <+44>:	isb	sy
   0x080018d0 <+48>:	ldr	r2, [r3, #20]
   0x080018d2 <+50>:	orr.w	r2, r2, #131072	; 0x20000
   0x080018d6 <+54>:	str	r2, [r3, #20]
   0x080018d8 <+56>:	dsb	sy
   0x080018dc <+60>:	isb	sy
   0x080018e0 <+64>:	ldr	r3, [pc, #168]	; (0x800198c <SystemClock_Config+236>)
   0x080018e2 <+66>:	movs	r4, #2
   0x080018e4 <+68>:	movs	r0, #25
   0x080018e6 <+70>:	ldr	r2, [r3, #64]	; 0x40
   0x080018e8 <+72>:	orr.w	r2, r2, #268435456	; 0x10000000
   0x080018ec <+76>:	str	r2, [r3, #64]	; 0x40
   0x080018ee <+78>:	ldr	r3, [r3, #64]	; 0x40
   0x080018f0 <+80>:	ldr	r2, [pc, #156]	; (0x8001990 <SystemClock_Config+240>)
   0x080018f2 <+82>:	and.w	r3, r3, #268435456	; 0x10000000
   0x080018f6 <+86>:	str	r3, [sp, #4]
   0x080018f8 <+88>:	ldr	r3, [sp, #4]
   0x080018fa <+90>:	ldr	r3, [r2, #0]
   0x080018fc <+92>:	bic.w	r3, r3, #49152	; 0xc000
   0x08001900 <+96>:	orr.w	r3, r3, #32768	; 0x8000
   0x08001904 <+100>:	str	r3, [r2, #0]
   0x08001906 <+102>:	ldr	r3, [r2, #0]
   0x08001908 <+104>:	str	r1, [sp, #40]	; 0x28
   0x0800190a <+106>:	movs	r1, #13
   0x0800190c <+108>:	and.w	r3, r3, #49152	; 0xc000
   0x08001910 <+112>:	str	r4, [sp, #72]	; 0x48
   0x08001912 <+114>:	str	r3, [sp, #8]
   0x08001914 <+116>:	ldr	r3, [sp, #8]
   0x08001916 <+118>:	movs	r3, #1
   0x08001918 <+120>:	str	r3, [sp, #52]	; 0x34
   0x0800191a <+122>:	mov.w	r3, #327680	; 0x50000
--Type <RET> for more, q to quit, c to continue without paging--
   0x0800191e <+126>:	strd	r1, r3, [sp, #32]
   0x08001922 <+130>:	mov.w	r3, #4194304	; 0x400000
   0x08001926 <+134>:	strd	r4, r3, [sp, #56]	; 0x38
   0x0800192a <+138>:	mov.w	r3, #432	; 0x1b0
   0x0800192e <+142>:	strd	r0, r3, [sp, #64]	; 0x40
   0x08001932 <+146>:	movs	r3, #9
   0x08001934 <+148>:	add	r0, sp, #32
   0x08001936 <+150>:	str	r3, [sp, #76]	; 0x4c
   0x08001938 <+152>:	bl	0x8001240 <HAL_RCC_OscConfig>
   0x0800193c <+156>:	cbz	r0, 0x8001952 <SystemClock_Config+178>
   0x0800193e <+158>:	bl	0x800078c <hal_debugger_connected>
   0x08001942 <+162>:	cbz	r0, 0x8001946 <SystemClock_Config+166>
   0x08001944 <+164>:	bkpt	0x0001
   0x08001946 <+166>:	movs	r3, #0
   0x08001948 <+168>:	mov	r2, r3
   0x0800194a <+170>:	mov	r1, r3
   0x0800194c <+172>:	mov	r0, r3
   0x0800194e <+174>:	bl	0x8001b5c <__assert_func>
   0x08001952 <+178>:	movs	r3, #15
   0x08001954 <+180>:	mov.w	r2, #5120	; 0x1400
   0x08001958 <+184>:	str	r0, [sp, #20]
   0x0800195a <+186>:	movs	r1, #7
   0x0800195c <+188>:	add	r0, sp, #12
   0x0800195e <+190>:	strd	r3, r4, [sp, #12]
   0x08001962 <+194>:	mov.w	r3, #4096	; 0x1000
   0x08001966 <+198>:	strd	r2, r3, [sp, #24]
   0x0800196a <+202>:	bl	0x8001618 <HAL_RCC_ClockConfig>
   0x0800196e <+206>:	cmp	r0, #0
   0x08001970 <+208>:	bne.n	0x800193e <SystemClock_Config+158>
   0x08001972 <+210>:	str	r0, [sp, #44]	; 0x2c
   0x08001974 <+212>:	str	r0, [sp, #56]	; 0x38
   0x08001976 <+214>:	add	r0, sp, #32
   0x08001978 <+216>:	str	r4, [sp, #32]
   0x0800197a <+218>:	bl	0x8001240 <HAL_RCC_OscConfig>
   0x0800197e <+222>:	cmp	r0, #0
   0x08001980 <+224>:	bne.n	0x800193e <SystemClock_Config+158>
   0x08001982 <+226>:	add	sp, #80	; 0x50
   0x08001984 <+228>:	pop	{r4, pc}
   0x08001986 <+230>:	nop
   0x08001988 <+232>:			; <UNDEFINED> instruction: 0xed00e000
   0x0800198c <+236>:	subs	r0, #0
   0x0800198e <+238>:	ands	r2, r0
   0x08001990 <+240>:	strb	r0, [r0, #0]
   0x08001992 <+242>:	ands	r0, r0
End of assembler dump.
(gdb) p registers
No symbol "registers" in current context.
(gdb) info registers
r0             0x20021a60          537008736
r1             0x0                 0
r2             0x8683              34435
r3             0x40023800          1073887232
r4             0x8004160           134234464
r5             0x8004160           134234464
r6             0x0                 0
r7             0x0                 0
r8             0x0                 0
r9             0x0                 0
r10            0x0                 0
r11            0x0                 0
r12            0x0                 0
sp             0x2005bff8          0x2005bff8
lr             0x8000d57           134221143
pc             0x80018a0           0x80018a0 <SystemClock_Config>
xPSR           0x61000000          1627389952
fpscr          0x0                 0
msp            0x2005bff8          0x2005bff8
psp            0x0                 0x0
primask        0x0                 0
basepri        0x0                 0
faultmask      0x0                 0
control        0x0                 0
(gdb) si
halted: PC: 0x0800064e
Default_HardFault_Handler () at repos/apache-mynewt-core/boot/startup/src/interrupts.c:39
39	    while(1);
(gdb) 

vs-pp avatar Jun 10 '25 03:06 vs-pp

This problem was fixed by #3364 and #3395 and should work on master branch

kasjer avatar Jun 10 '25 10:06 kasjer

should be fixed in master, please reopen if needed

sjanc avatar Aug 06 '25 11:08 sjanc