i have downloaded the library and seen that you used a start up file startup.s somewhere.but you did not include it in the make file anywhere.I am sure i am missing something at this point.how do i tell the compiler to use the start up file?
abhinav:
i have downloaded the library and seen that you used a start up file startup.s somewhere.but you did not include it in the make file anywhere.I am sure i am missing something at this point.how do i tell the compiler to use the start up file?
I did write a little bit about a minimal config here:
You’re making it harder than it is by intentionally starting everything from the wrong side…
Get the complete project, configure the clocks and LED port + pin (config.h), compile & test it - if something is wrong here, it’s on your side. If it works fine (the configured led blinks) then start modifying it to your needs and try to understand how it all works TOGETHER. The linker script is tightly coupled with startup.s and vectors.c which are tightly coupled with makefile - probably none of the four would work “alone” “out of the box” - but they can operate simultaneously without problems in any project that obeys the simple rules…
The startup.s assembly file IS referenced in the Makefile via a wildcard for all files which match a .s pattern - just like C (.c) or C++ (*.cpp) files are.
And I know that you haven’t used all four, because my makefile uses gcc for linking, and that’s intentional… You have also modified the vector table (what for?) because the entry there says Reset_Handler, not Reset_handler.
Do it as I’ve recommended or keep doing random changes here and there without understanding. The choice is yours.
ya i used your code to successfully blink the LED.but when i tried to flash it again after erasing the LED program (stm32x mass_erase 0), the write failed saying
flash write_bank 0 main.bin 0
not enough working area available(requested 16384, free 8144)
timed out while waiting for target halted
error executing stm32x flash write algorithm
flash writing failed with error code: 0xfffffc7a
error writing to flash at address 0x08000000 at offset 0x00000000 (-902)
called at file “command.c”, line 469
called at file “embedded:startup.tcl”, line 89
called at file “embedded:startup.tcl”, line 91
called at file “embedded:startup.tcl”, line 93
any idea what this implies?
I also looked up the stm32x.c file and found out that this error may occur when the file sixe is greater than the flash size.when i checked, my bin file size was 512 Mb.I dont know why it ballooned into such a big file when all the the .o files are of normal size.any idea?
The solution is simple - don’t use bin files! Use hex or elf.
They are so big, because there are no addresses - what’s why a file with single byte at 0x8000000 has to have 0x7FFFFFF zeroes in front of it. But they don’t have to, because you can dump only some address range, but then after a few days you really don’t know what does the bin file contain… Or maybe you have something messed up with the linker script, and the bin file contains entries from the RAM, so between 0x8000000 and 0x20000000 it has a lot of zeroes again… They’re just worthless…
I hope that you “reset halt” the chip before trying anything?
Ok - this is my last advice - take a look at my linker script and compare it to yours. Every difference you find is YOUR MISTAKE.
EOT for me, as you are really creating problems. The linker file that I posted on my webpage is a “right” one and solves your problems. If you really want to write your own, take a look at how it’s done IN DETAILS.
BTW - you do know that STM32 actually has flash at 0x8000000 and not at 0x0?