Hi all,
I have searched the forums high and low but still can't find a definitive answer. I'm hoping there are some gurus out there that can point me in the right direction.
My question is: How do I successfully include a 'c' header file in the STARTUP.A51 file? NB: My c header file only includes #defines etc
I was under the impression that the C preprocessor should be able to do this easily? Alas, I can't compile my code because the compiler doesn't recognize the symbols in my STARTUP.A51 (which are specified in my header file).
In case you were wondering, here's some background info:
Basically, I have had to edit the STARTUP.A51 file, in order to redirect some interrupts for my bootloader application.
The interrupts jump to a memory address that I have called (say) "APPLICATION_VECTOR_TABLE_ADDRESS"
This all works fine.
All I want to do is #define APPLICATION_VECTOR_TABLE_ADDRESS in my c header file - because this needs to be shared amongst several source files.
I am using the uVision4 IDE, and C51 compiler V9.01.
Look forward to some responses. Cheers
a .h file?
if you post your "'c' header" and your modified startup it woud be helpful
Erik
Are the assembler files always sent through the preprocessor?
How do I successfully include a 'c' header file in the STARTUP.A51 file?
You just do it. Yes, it's that simple.
Hi, Thanks for your replies. Yes, just to clarify I am refering to a .h file.
It clearly isn't just as simple as typing #include headerfile.h in the STARTUP.A51 code - because it if were - it would work - which it isn't.
This is (some of) my STARTUP CODE: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include "MEMORYMAP.h" $NOMOD51 IDATALEN EQU 80H XDATASTART EQU 0 XDATALEN EQU 0 PDATASTART EQU 0H PDATALEN EQU 0H
~~more statup code here~~
CSEG AT 0 LJMP irq0
CSEG AT 0x100
irq0: CLR A MOV DPTR,#(isBootMode) MOVX A,@DPTR JZ irq0App
irq0Boot: LJMP externalIntISR irq0App: LJMP APP_VEC_ADDRESS+0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ My MemoryMap.h file only includes the following code:
#define APP_VEC_ADDRESS 0x5000 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do I have to change the compling/linking order of the source files? ie: Does the linker have to see memorymap.h before it sees STARTUP.A51?
Is STARTUP.A51 even sent through the C preprocessor???
Cheers
Oh I forgot to mention ... if I actually compile the code above (ie: with the #include memorymap.h"), I get the following error:
..\Common\STARTUP.A51(238): error A45: UNDEFINED SYMBOL (PASS-2)
The "UNDEFINED SYMBOL" is refering to APP_VEC_ADDRESS.
Cheers, T
Anyone have any ideas here? Cheers, T
My guess is that your startup file isn't sent through the preprocessor, in which case the assembler will see a strange and unknown symbol, instead of the hexadecimal value you intended the assembler to see.
http://www.keil.com/support/man/docs/a51/a51_mp_c.htm
note the difference between IF and $IF, etc: http://www.keil.com/support/man/docs/a51/a51_ap_conditional.htm and check if there are other such variations or limitations of any other directives that you use...