I already have software written in assembly
E2Studio creates startup code in C.
Somewhere in there I have to add a call to the assembly program.
Where does it go? I'm guessing that it might be the .src directory
My assembly program starts at main: which is declared ".global"
Hello, Ian.
Do you use GCC?GCC will accept *.S as assembler source file.GCC - Overall options (see file extension)https://gcc.gnu.org/onlinedocs/gcc-8.4.0/gcc/Overall-Options.html
All my code was written in NXP's version of Eclipse (which they call MCUXpresso), so it is written in Gnu AS. It can be cut and pasted into the .src directory verbatim and E2Studio will assemble it. Of course, all the original startup code which set all the peripherals up is useless, and E2Studio wants to give me C to do that.
What I want to do is make my assembler code run, and I presume I have to call main: from somewhere in E2Studio's generated startup code. That's what I'm trying to find out.
Looking at a GCC project within e2 using the RX processor, reset_program.S is the assembly file that is vectored to once /RESET is released to begin processing. You should be able to insert assembly code that you desire to run in that file. It may be different for your Renesas processor usage however. Hope this helps.
Do you have reset_program.S for RX24u to share w/ me as example? Thanks
It doesn't seem to generate reset_program.s, everything it generates is either a .h or a .c.
The most likely place seems to be a file called hal_entry.c in the src directory, as there is a comment like that says "to do: add your own code here".
Program entry point (of which address written in reset vector) can be C function.
I think I'm getting close - it needs to call cardinit in the assembler
In the C program I have
void Reset_Handler (void)
{ extern void cardinit(void); cardinit(); return ;}
{
extern void cardinit(void);
cardinit();
return ;
}
and in the assembler
.thumb_func.global cardinit.type cardinit,%functioncardinit: PUSH {R4,LR}
.thumb_func
.global cardinit
.type cardinit,%function
cardinit: PUSH {R4,LR}
and it returns with
"undefined reference to `cardinit'", but I'm not sure how to make it look in the right place for "cardinit"
Then try using _cardinit in assembler source.
Tried that - with _ in the assembler, and again with _ in both the C and the assembler, then again with __
Same result.
You have to use the "_"-prefix only in the assembler source code in the declaration and the definition:
global _cardinit
..._cardinit:
_cardinit:
If that doesn't solve the error, please check the manual of your compiler for the details of calling- convention or assembler-interface.
It's not that, it's actually quite happy without the "_" in the assembler, but what is does want is for the assembler file to be called .S and not .s
NXP's version of Eclipse is quite happy with .s
Getting somewhere now. . . .