Jump to content
43oh

Blinky asm sample


Recommended Posts

Hello,

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

INC=    $(STELLARISWARE)

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)

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

With this ldStart.ld

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

SECTIONS
{
    .text :
    {
     	_text = .;
	KEEP(*(.isr_vector))
	*(.text*)
	*(.rodata*)
	_etext = .;
    } > FLASH

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

    .bss :
    {
     	_bss = .;
	*(.bss*)
	*(COMMON)
	_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

Hi,

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.
 
Lyon
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

Hi,

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...

Lyon 

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.

Guest
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...