Skip to content

No output following book STM32F303 #199

@leshow

Description

@leshow

I have been following the guide up to hardware.

When following through, I'm not able to get "Hello, world!" printed out using hprintln!. This is my output:

from openocd:

none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v27 API v2 SWIM v15 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 2.913064
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x10036422
Info : flash size = 256kbytes
undefined debug reason 7 - target needs reset
semihosting is enabled
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
adapter speed: 950 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080015ca msp: 0x20010000, semihosting
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
Info : Padding image section 0 with 10 bytes
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20010000, semihosting
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
adapter speed: 950 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080015ca msp: 0x20010000, semihosting
Info : halted: PC: 0x0800163a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a
Info : halted: PC: 0x0800184a

It just continues on that instruction over and over.

and from gdb:

Transfer rate: 12 KB/sec, 2403 bytes/write.
Note: automatically using hardware breakpoints for read-only addresses.
DefaultPreInit () at /home/leshow/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.6.9/src/lib.rs:564
564     pub unsafe extern "C" fn DefaultPreInit() {}
(gdb) break main
Note: breakpoint 4 also set at pc 0x8000480.
Breakpoint 5 at 0x8000480: file examples/hello.rs, line 13.
(gdb) continue
Continuing.

Breakpoint 2, HardFault_ (ef=0x0)
    at /home/leshow/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.6.9/src/lib.rs:548
548             atomic::compiler_fence(Ordering::SeqCst);
(gdb) next
^C
Program received signal SIGINT, Interrupt.
0x0800184a in HardFault_ (ef=0x0)
    at /home/leshow/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.6.9/src/lib.rs:548
548             atomic::compiler_fence(Ordering::SeqCst);

Also, my memory.x file had FLASH : ORIGIN = 0x00000000, LENGTH = 256K in it, but the book said 0x08000000 so I've changed it to that. I'm not sure if that's the correct value.

I have the stmf32f303 exactly the same board as described in the book. When I plugged it in before the board used to light up and I could press the 'user' button to cycle through the accelerometer and gyroscope. Now the board just has a red power indicator and the COM set to red all the time. I'm not sure if this is normal or because I actually ran something on the board the initial program it was loaded with is gone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions