My project involve FATFS and USB MSC. We started this project with STM32L073 MCU. Than, we changed our MCU with STM32L072. After changing MCU, we faced the problem. Now, I can build my code without problem. But, program doesnt reach the main.
Before i send this post, I read some advice about this issue.
Firstly, i checked heap in my startup file. Increasing heap didnt work in my case but, strange thing is that increasing heap doesnt increase ram usage. I doubt about this. As i know, increasing heap usage should increase ram usage.
In disassembly screen, there is a branch line like below. This branch line sources of infinite loop.
0x1FF001EC F7FFFF7A BL.W 0x1FF000E4
0x1FF001F2 2800 CMP r0,#0x00
0x1FF001F4 D0B6 BEQ 0x1FF00164
I need your advices about how can i fix this or which part of project do i check?
c.yesildag said:we changed our MCU
I'm not sure that changing the target MCU of an existing project is even supposed to work ?
Try starting a new, blank project for the new MCU - and then merge your code into that.
Thaks for reply,
I didn't change target MCU on my project. I started new project than i merged existing code.
So did the new project work before your started merging your code into it?
What hardware are you using? Are you sure (and, if so, how) that the hardware is good, properly configured, etc ?
Yes, project worked properly before merging.
Firstly, I developed project with STM32 Nucleo-64 board(STM32L073RZ MCU) and uVision IDE.
Than, we developed our custom board with STM32L072RBT. I reconfigured our project for our board.
I used custom board. Hardware hasn't problem. It is safe zone. I used this hardware with same software. But i used Stm32cubeIde. It worked without any problem.
But there is a ram usage problem, that's why i returned uVision. (Project developed uVision first)
In uVision, we cant start our software as i mentioned above.
c.yesildag said:Yes, project worked properly before merging.
So merge you code gradually, and find where it goes wrong.
More likely to be stack than heap, size set in startup.s
Unchecked the "Run to main()" option and follow code execution. Look at what is happening in SystemInit(), and whether you fail into the HardFault_Handler
Thanks for advice.
I suspected heap according to this http://www.keil.com/support/docs/3614.htm
I unchecked "Run to main()" than follow code execution. Program cant reach SystemInit().
I follow PC. Its value change between 0x1FF00164 and 0x1FF001F4. It is like that CPU controls some thing and doesnt satisfy and branch 0x1FF00164.
About to heap:
I increase heap from startup file. But my ram usage doesn't change. Is it not strange? As i know, heap consumes Ram memory.
You have booted into System Memory and not Flash.
Make sure the BOOT0 pin is LOW
Double check the address you're building code for
It was my problem.
Thanks a lot.
View all questions in Keil forum