This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Including a 'c' header file in the STARTUP.A51 file

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

Parents
  • 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

Reply
  • 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

Children