I have seen that the assembler uses the #define as in C, but I have the problem that for checking if already defined seems not to be the same, for C in the H file is with #ifndef/#define/#endif and for ASM is ifndef/#define/endif, notice that for ASM the check block does not uses the # prefix.
So how can I create a single file of definitions to get included by both C and ASM?
Share definitions between C and ASM?
-
- Member
- Posts: 71
- Joined: Sun Apr 01, 2018 4:02 pm
Re: Share definitions between C and ASM?
I think that the easiest solution is wrap the assembler in a C file:
Code: Select all
static void wrapper() __naked
{
__asm
SECTION ...
PUBLIC ...
__endasm;
}
-
- Member
- Posts: 71
- Joined: Sun Apr 01, 2018 4:02 pm
Re: Share definitions between C and ASM?
Probably, but I like to have the ASM in its own file with its format then assemble.
Currently what I do is duplicate those definitions, and when I am going to change one, "grep" for that definition in all sources and change in both if required.
If I'd do it frequently, then a bash script for changing definitions in all files it appears could make the trick, but is not so often to do it.
Currently what I do is duplicate those definitions, and when I am going to change one, "grep" for that definition in all sources and change in both if required.
If I'd do it frequently, then a bash script for changing definitions in all files it appears could make the trick, but is not so often to do it.
Re: Share definitions between C and ASM?
Paulo just pushed a change which supports #ifdef etc in the assembler, so that will be in tonights build
-
- Member
- Posts: 71
- Joined: Sun Apr 01, 2018 4:02 pm