Skip to content
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

Led roulette blocks execution when using STM32F3348-DISCO #109

Open
nvinuesa opened this issue Aug 25, 2018 · 4 comments
Open

Led roulette blocks execution when using STM32F3348-DISCO #109

nvinuesa opened this issue Aug 25, 2018 · 4 comments

Comments

@nvinuesa
Copy link

Hi Jorge, first of all thanks a lot for your great job on rust-embedded 😃 .

I am using the STM32F3348-DISCO board which is the replacement for the STM32F3DISCOVERY (no longer available in my country).

When I follow the instructions, everything builds, flashes and starts debugging correctly. The problem is that if I hit continue (in gdb) after setting the breakpoint, it blocks indefinitely; and if I step a few times, I arrive to this statement and it blocks:

   ┌──asm.s────────────────────────────────────────────────────────────────────────────────────────┐
   │1         .global HardFault                                                                    │
   │2         .thumb_func                                                                          │
   │3       HardFault:                                                                             │
   │4         mrs r0, MSP                                                                          │
  >│5         bl UserHardFault                                                                     │
   │6                                                                                              │
   │7                                                                                              │
   │8                                                                                              │
   │9                                                                                              │
   │10                                                                                             │
   │11                                                                                             │
   │12                                                                                             │
   │13                                                                                             │
   │14                                                                                             │
   │15                                                                                             │
   │16                                                                                             │
   │17                                                                                             │
   │18                                                                                             │
   │19                                                                                             │
   │20                                                                                             │
   │21                                                                                             │
   │22                                                                                             │
   │23                                                                                             │
   │24                                                                                             │
   │25                                                                                             │
   │26                                                                                             │
   │27                                                                                             │
   │28                                                                                             │
   └───────────────────────────────────────────────────────────────────────────────────────────────┘
remote Remote target In: HardFault                                              L5    PC: 0x80003ee
Loading section .rodata, size 0x6c lma 0x80004a0
Start address 0x800023a, load size 1286
Transfer rate: 4 KB/sec, 428 bytes/write.
(gdb) l
(gdb) l
(gdb) step
Reset ()
    at /Users/nico/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.5.2/src/lib.rs:494
(gdb) step
(gdb) step
HardFault () at asm.s:4
(gdb) step
(gdb) step
Note: automatically using hardware breakpoints for read-only addresses.

Now, I am aware that this problem may come from the fact that the board is not exactly the same as you used; and more specifically, when compiling I see Compiling stm32f30x v0.7.0 and my board uses the STM32F334C8 MCU instead of an STM32F30x.

Is there something I can change or would you have any idea how to solve this?

Thanks a lot

@thejpster
Copy link

The STM32F3DISCOVERY has a STM32F303VCT6 microcontroller while your board has a STM32F334C8. The 33x and 30x series are going to be similar in terms of peripherals, but not fully compatible. Differences such as a peripheral being at a different address, or simply because they have different amounts of RAM and/or Flash, can cause the HardFault exception to be raised, as you have seen.

You'll need to look at forking the japaric/f3 repo and patching it to support the STM32F3x4 line instead of the STM32F30x line, or skipping the F3 crate entirely and using a lower-level crate like https://github.com/adamgreig/stm32-rs/blob/master/stm32f3/src/lib.rs.

@nvinuesa
Copy link
Author

Great, I'll do that!

Thanks

@MarkGrant06
Copy link

hi all,

any update on this? (I have rhe same problem)

do you have a memory.x for this MCU?

thanks,
Mark

@MarkGrant06
Copy link

OK.. I'll answer my own question... by updating the memory.x for the f3 crate to the one below, I can now get it to work:

MEMORY
{
CCRAM : ORIGIN = 0x10000000, LENGTH = 8K
FLASH : ORIGIN = 0x08000000, LENGTH = 64K
RAM : ORIGIN = 0x20000000, LENGTH = 16K
}

_stack_start = 0x20001000;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants