We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi All, I have been using uV4 for a few months and wrote a couple of programs for the discovery board I bought which as an STM32F407VG. a few weeks back I wrote a program to test the Usart which it worked well sending some ADC data to the PC. I decided to do a few modifications relating to the way the uC handles the packets received via the USART and now the program will run through the initialisation part of the program but it seems not to go into main. I have now remove all the new parts of the program and it still will not run. I have stepped through the program and it is going to setup of the system clk and memory relocation and so on, but when it gets to main it stops working. I am at a bit of a loss on what is the issue as I have not modified anything in the program relating to main. Just wandering if any of you as come across this problem before.
Best Regards Luis
This is exactly the kind of situation where a version control system would help. It would allow you to see what changes were made between a known good state and a broken state. Try Mercurial (TortoiseHg), it is quite user-friendly. Maybe you should rewrite the program from scratch? Only this time keep the record of your changes in a VCS. By the way, did you try to locate the exact place where the program malfunctions? You can single-step in the disassembly window.
Hi Mike, I did single step it, and it stops when it goes into the main function, or at least that is how it looks like. in terms of the disassembly window it stops when it reaches here:
__scatterload_zeroinit: 0x080001E0 2300 MOVS r3,#0x00 0x080001E2 2400 MOVS r4,#0x00 0x080001E4 2500 MOVS r5,#0x00 0x080001E6 2600 MOVS r6,#0x00 0x080001E8 3A10 SUBS r2,r2,#0x10 ----------------------------------- 0x080001EA BF28 IT CS 0x080001EC C178 STM r1!,{r3-r6} 0x080001EE D8FB BHI 0x080001E8 *I presume this is a branch instruction* 0x080001F0 0752 LSLS r2,r2,#29 0x080001F2 BF28 IT CS 0x080001F4 C130 STM r1!,{r4-r5} 0x080001F6 BF48 IT MI 0x080001F8 600B STR r3,[r1,#0x00] 0x080001FA 4770 BX lr
Then it keeps on cycling at BHI instruction when I am single stepping it. when just running it actually stops running at the BKPT instruction below.
_sys_open: 0x080018B6 B50E PUSH {r1-r3,lr} 0x080018B8 E9CD0100 STRD r0,r1,[sp,#0] 0x080018BC F000FBA6 BL.W strlen (0x0800200C) 0x080018C0 9002 STR r0,[sp,#0x08] 0x080018C2 4669 MOV r1,sp 0x080018C4 2001 MOVS r0,#0x01 0x080018C6 BEAB BKPT 0xAB *** it stops Here*** 0x080018C8 BD0E POP {r1-r3,pc}
Agreed that I need to look at some sort of version control software. the best option is to probably start from scratch.
Thank you. Best Regards Luis
I seem to remember that some library calls pull file IO code from the library. File IO is initialized prior to main(), so this would be consistent with what you are experiencing (_sys_open and all). IIRC, the easiesy way to solve the problem is to switch to microlib (there is a corresponding checkbox somewhere in the project settings).