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

Can't get conditional compile to work in .s file

In Embedded_Files.s I have several INCBIN that then compile in several .bin files. I don't want to include those files unless there is a project-level #define made (either in a file that is global to all, or in the actual project itself).
I've tried what several Google searches suggested (#ifdef USE_WIFI and %ifdef USE_WIFI at the top of the file, and I get :

Embedded_Files.s(1): error: A1163E: Unknown opcode USE_WIFI , expecting opcode or Macro

What is going on here? What am I missing?

  • Keil use of definitions in .S file

    ;*******************************************************************************
    ; User Stack and Heap initialization
    ;*******************************************************************************
                     IF      :DEF:__MICROLIB
    
                     EXPORT  __initial_sp
                     EXPORT  __heap_base
                     EXPORT  __heap_limit
    
                     ELSE
    
                     IMPORT  __use_two_region_memory
                     EXPORT  __user_initial_stackheap
    
    __user_initial_stackheap
    
                     LDR     R0, =  Heap_Mem
                     LDR     R1, =(Stack_Mem + Stack_Size)
                     LDR     R2, = (Heap_Mem +  Heap_Size)
                     LDR     R3, = Stack_Mem
                     BX      LR
    
                     ALIGN
    
                     ENDIF
    

  • What you seem to have been missing is to ensure that the results you found with google were specifically applicable to the particular tool (the ARM Assembler) that you are using.

    infocenter.arm.com/.../index.jsp

    It is important to understand that assembler syntaxes are not standardised!

    Even in 'C', it is important to understand that some things are implementation-defined - so they may be different on different implementations - and most compilers also have some proprietary language extensions ...

  • Thank you Clive. Your answer was most helpful

  • Thanks Andrew. I reviewed the link, and yes it makes sense for some assembly calls to be tool specific. I was down the wrong-track think that compiler pre-processor commands were compiler specific and that Keil based commands would be consistent across all tools. Clearly I was mistaken :-)