Effectivement, ma langue premiere est le francais! Its not only my name which can betray me, my written english do the job also ;) Thanks very much for this example! However, I didnt see other examples at your address. Is there example with function using argument (like int dummyFct(int a, int b))? Thanks! Fred -------------------------------------------- Frederic Beaulieu, M.Sc. Research and Development NewTrax Technologies Inc. HYPERLINK "http://www.newtraxtech.com/"http://www.newtraxtech.com/ -----Original Message----- From: mspgcc-users-ad...@lists.sourceforge.net [mailto:mspgcc-users-ad...@lists.sourceforge.net] On Behalf Of thln Sent: Wednesday, August 24, 2005 11:05 AM To: mspgcc-users@lists.sourceforge.net Subject: Re: [Mspgcc-users] Assembler file organisation Salut ! Avec un nom comme ça, je pense que tu parles français !
Assembler file in C project // *** test.c *** /* you should declare your assembler function in your C file */ extern void _Init_System(void); int main(void) { /* You can call the function like this */ _Init_System(); while(1) { /* Xor bit0 of P1 */ P1OUT^=0x01; } } // *** end of test.c *** // *** system.asm *** ; "hardware.h" is your IO, System definition (for the minimal test you create an empty file) #include "hardware.h" // declaration of your function (visible for the linker process) .global _Init_System .text ;----------------------------------------------------------------------- ------ ; ENTREE : Rien ; SORTIE : Registres systèmes ; MODIF : ;----------------------------------------------------------------------- ------ _Init_System: ; init P1 mov.b #0x01,&P1DIR mov.b #0x00,&P1SEL mov.b #0x00,&P1OUT mov.b #0x00,&P1IFG mov.b #0x00,&P1IE ret // *** end of system.asm*** // *** makefile *** .SUFFIXES: # Delete the default suffixes NAME=aout.elf CC=msp430-gcc CPU=msp430x123 DUMP=msp430-objdump ASMOPT = -mmcu=${CPU} CFLAGS = -mmcu=${CPU} -O1 -ffixed-r4 -ffixed-r5 LDFLAGS = -mmcu=$(MCU) -Wl,-Map=$(NAME).map --cref OBJECTS = test.o system.o all: ${NAME} %.o: %.c hardware.h $(CC) ${CFLAGS} -c $< $(DUMP) -DS $@ > $<.lst %.o: %.asm hardware.h $(CC) -x assembler-with-cpp ${ASMOPT} -D_GNU_ASSEMBLER_ -o $@ -c $< ${NAME}: ${OBJECTS} $(CC) -mmcu=${CPU} $(LDFLAGS) -o $@ $^ $(DUMP) -DS aout.elf > aout.lst msp430-objcopy -O ihex $@ $...@.hex .PHONY: clean clean: rm -f ${NAME} ${NAME}.hex ${OBJECTS} // *** end of makefile *** This is a minimal project ! I advise you to download examples projects here : HYPERLINK "http://cvs.sourceforge.net/viewcvs.py/mspgcc/examples/"http://cvs.sourc eforge.net/viewcvs.py/mspgcc/examples/ you can modify some examples for your tests. What is your application ? Me, I use MSP430F427 for instrumentation devices. A+ ----- Original Message ----- From: HYPERLINK "mailto:fbeaul...@newtraxtech.com"Frederic Beaulieu To: HYPERLINK "mailto:mspgcc-users@lists.sourceforge.net"mspgcc-us...@lists.sourceforg e.net Sent: Wednesday, August 24, 2005 3:02 PM Subject: RE: [Mspgcc-users] Assembler file organisation Is there someone who know how to call an assembler function define in a .S file from a C program? -------------------------------------------- Frederic Beaulieu, M.Sc. Research and Development NewTrax Technologies Inc. HYPERLINK "http://www.newtraxtech.com/"http://www.newtraxtech.com/ -----Original Message----- From: HYPERLINK "mailto:mspgcc-users-ad...@lists.sourceforge.net"mspgcc-users-ad...@list s.sourceforge.net [mailto:mspgcc-users-ad...@lists.sourceforge.net] On Behalf Of Frederic Beaulieu Sent: Tuesday, August 23, 2005 11:43 AM To: MSP430 mspgcc Groups Subject: [Mspgcc-users] Assembler file organisation Hi all, I want to do my next project using only assembly to learn a little bit more about this language. I never use it before. I wonder if someone can explain to me how to manage a large project (how you manage your file .s .S .h, how you separate your function in these files, how you organize your comments, etc). The example from TI are to basic to learn from these (too small). May be you can send me one of your old (even very old ;)) project. Thanks in advance! Fred -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.15/80 - Release Date: 8/23/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.15/80 - Release Date: 8/23/2005