This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

New to Arm cortex m3

Note: This was originally posted on 9th June 2009 at http://forums.arm.com

Hi everyone,
I recently got an Arm cortex m3 microcontroller (stm32f103ret6).  I'm interested in programming in assembly only.  I received some software with the kit I bought (keil uvision, IAR workbench kickstart and ride7) but i find all of these a little confusing to use.  Reading the book "the definitive guide to arm cortex m3", I beleive the simplest way to compile and build assembly code is using arm tools, I found some of these in the keil software directory (armasm, armlink, fromelf).  the book describes assembling using this command line:

armasm --cpu cortex-m3 -o test.o test.s

this however doesn't work I realized i had to replace the "--cpu cortex-m3" with "--device stm32".  This makes me wonder if there are different arm tools or variations in different software or if the book was just wrong? Or is this what your supposed to use on linux (I'm using windows)?

the next thing to do is to link the object I seen an example using the following command:

armlink --rw-base 0x20000000 --ro-base 0x0 --map -o test.elf test.o

my question is: is the ro (read only) supposed to be your code that goes into the flash? and rw is the data that goes to the ram?

My microcontroller's flash starts at 0x80000000 (i think), when linking should i set the ro-base at the address 0x80000000 or at 0x0, I've used flash loader demo to successfully upload sample code to my microcontroller.

I have also seen "startup code" on some programs, looking at the code it looks like it sets up the interrupt vector table and stack.  is this absolutely necessary or can you get away with omitting this code and just setup the vectors you will be using?  If someone can elaborate on this.

Any help would be greatly appreciated
Parents
  • Note: This was originally posted on 16th June 2009 at http://forums.arm.com

    Hi everyone,
    I recently got an Arm cortex m3 microcontroller (stm32f103ret6).  I'm interested in programming in assembly only.  I received some software with the kit I bought (keil uvision, IAR workbench kickstart and ride7) but i find all of these a little confusing to use.


    Hello,

    I'm only a tiny bit farther along, also using a board with an STM32f103 series chip. 
    I found the info on this: [url="http://<a%20href="http://wiki.fosstronics.com/"%20target="_blank">http://wiki.fosstronics.com/</a>"]Fosstronics_Wiki[/url]
    to be most helpful in setting up a toolchain, and using it. 

    In particular, this site has an article titled [url="http://wiki.fosstronics.com/arm_cortex-m3/stm32/minimal-c-program"]"Writing a minimal C program for the STM32 Primer" [/url]
    that is
        (a) really minimal (under 20 lines, not counting comments) and self contained,
        (b) detailed, including snippets of console log,
        © gives enough detail (e.g. on linker scripts and how to look at the raw bytes) to get one started doing more. 

    I was able to adapt this (from the STM32 primer) to a different board, and get it working via serial download. 
    If you're willing to dip a toe into the C language, this may be a good way to start.  (And if not, it shows the assembly code that results, so you could work from that if you prefer.)

    FYI, some more details, and a couple screen shots are online on my [url="http://repstrap-cerberus.blogspot.com/"]repRap build blog[/url] in the entry dated may 24, 2009. 

    Hope this helps,

    Larry
Reply
  • Note: This was originally posted on 16th June 2009 at http://forums.arm.com

    Hi everyone,
    I recently got an Arm cortex m3 microcontroller (stm32f103ret6).  I'm interested in programming in assembly only.  I received some software with the kit I bought (keil uvision, IAR workbench kickstart and ride7) but i find all of these a little confusing to use.


    Hello,

    I'm only a tiny bit farther along, also using a board with an STM32f103 series chip. 
    I found the info on this: [url="http://<a%20href="http://wiki.fosstronics.com/"%20target="_blank">http://wiki.fosstronics.com/</a>"]Fosstronics_Wiki[/url]
    to be most helpful in setting up a toolchain, and using it. 

    In particular, this site has an article titled [url="http://wiki.fosstronics.com/arm_cortex-m3/stm32/minimal-c-program"]"Writing a minimal C program for the STM32 Primer" [/url]
    that is
        (a) really minimal (under 20 lines, not counting comments) and self contained,
        (b) detailed, including snippets of console log,
        © gives enough detail (e.g. on linker scripts and how to look at the raw bytes) to get one started doing more. 

    I was able to adapt this (from the STM32 primer) to a different board, and get it working via serial download. 
    If you're willing to dip a toe into the C language, this may be a good way to start.  (And if not, it shows the assembly code that results, so you could work from that if you prefer.)

    FYI, some more details, and a couple screen shots are online on my [url="http://repstrap-cerberus.blogspot.com/"]repRap build blog[/url] in the entry dated may 24, 2009. 

    Hope this helps,

    Larry
Children
No data