You'll probably find it easier to use the C compiler, even if you really
want to write your code in assembly. The code you've written doesn't have a
vector table, so the microcontroller won't be able to run your code. Also,
the stack pointer is uninitialized, so it won't be able to push anything on
the stack or return from subroutine calls.
Try using a file like this:
int main(void)
{
asm("nop");
}
Compile it with:
msp430-gcc -mmcu=msp430x1232 test.c -o test.elf
If you want to see the generated code, disassemble it with:
msp430-objdump -dS test.elf
Convert it to hex using:
msp430-objcopy -O ihex test.elf test.hex
The C compiler:
- puts main in the right place,
- sets the reset vector to point to the startup code, which calls main(),
- sets the stack pointer to the top of RAM
- adjusts memory locations depending on the micro you specify, instead of
using .org statements
- doesn't generate the extra bytes you found between 0x0000 and 0xDFFF.
Good luck.
On Mon, Aug 10, 2009 at 6:07 PM, david feldman <[email protected]> wrote:
>
> Thanks for another quick reply - I am getting really close - one fairly
> minor issue to go:
>
> I've fixed the source file f.s to look like what gcc expects:
>
> .arch msp430x1232
> .text
> .org 0xE000
> main: nop
> nop
> nop
> .end
>
> This assembles without error using the command line:
>
> msp430-gcc -c f.s -o f.out
>
> and I can then convert to intel hex using:
>
> msp430-objcopy -O ihex f.out f.hex
>
> And here is my only remaining problem: The object file f.out is about 56K
> long - it is filled with zero bytes from address 0000 to DFFF, then my 6
> bytes of expected object code (the three nops) beginning at E000. When this
> is converted to intel hex, I end up with a giant file full of 16-byte
> records that try to fill memory from 0000 to DFFF, then the expected 6-byte
> hex record showing the bytes beginning at E000 which are my tiny program
> above.
>
> So my remaining question - how to I tell msp430-gcc to confine it's output
> to the memory range I want (in this case, E000 up to the length of the
> program I'm trying to assemble)?
>
>