Jump to content

Blinky asm sample

Recommended Posts


I'm currently trying to make a simple blinky project in asm because I want 

something working for my base asm project.

So far I made this Makefile:

SRC=    blink.s

OBJS=   $(SRC:.s=.o)

NAME=   blink.bin

AS=     arm-eabi-as

LD=     arm-eabi-ld

OBJCPY= arm-eabi-objcopy


LIBS=   -L$(LIB_DIR_STELLARIS)/ -ldriver-cm4f

CFLAGS= -I$(INC) -g -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Wall

$(NAME): $(OBJS)
        $(LD) -T ldStart.ld -o a.out $(OBJS) --gc-sections
        $(OBJCPY) -O binary a.out $(NAME)

        rm -vf $(OBJS) $(NAME) *.d *.out

With this ldStart.ld

    FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
    SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000

    .text :
     	_text = .;
	_etext = .;
    } > FLASH

    .data : AT(ADDR(.text) + SIZEOF(.text))
     	_data = .;
	_edata = .;
    } > SRAM

    .bss :
     	_bss = .;
	_ebss = .;
    } > SRAM

But in blink.s there is just... nothing...

So it does compile but I can't obviously test it on my board.

I would like to know if someone have an asm sample for me to test it and see a result on the Stellaris.

Atm I'm not enough skilled to make one by myself.

Thank you

Link to post
Share on other sites


Here are two examples:


a) http://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/p/45978/156802.aspx#156802

and one advice: play with that for fun or to learn assembler a little bit, but do not waist your life with a project in asm - use C instead, more productive and close enough to assembler. Not to mention that for 32 bits is more difficult to do than for 8-bit micros.
Link to post
Share on other sites

Thanks a lot for your links but I already found them on the net and

I tried to adapt it to gnu gas ARM assembler but it did not work :( .

Maybe that's because of my Makefile, maybe because of what I tried to adapt?

I can't tell :( , that's why I wanted a real working gnu gas working assembly project.

And don't worry, that's only for study purpose with very small projects :P .

Btw, I already managed to get a C project working on the stellaris :) .

Link to post
Share on other sites


I understand you - as an example of file in .asm/gnu look at the file TivaWare/bootloader/startup_gcc.S - has enough to understand the syntax and how to begin an .asm file. Note the extension in .S - this is a requirement since usual gas is not called directly, but from gcc, which knows how to call gas. The upper later is needed because of an gcc error. 

Another (maybe) problem are your tools - you call "arm-eabi-xxx", while the right tools should be "arm-none-eabi-xxx" - 

Look also to the Makefile and makedefs in TivaWare - contain all you need to configure the tools.

Another thing to make your life easier: you can install Eclipse + GCC tools to have an IDE to work with. Has the advantage that with a right plug-in, you don't need to write makefiles, since it generates automatically for you. Not to speak about the debugger...


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...