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

Conditional Check in Assemly File Like C Preprocessor

I want to set the stack size in assembly depending on if a definition exists, in the same in way as is done in the C preprocessor.

For example in C I would do this:

#ifdef SMALL_STACK
Stack EQU 0x00000800
#else
Stack EQU 0x00008000
#endif

I found this article in the Assembler User's Guide:

www.keil.com/.../armasm_dom1361290015842.htm

And tried this:

IF :DEF:SMALL_STACK
Stack EQU 0x00000800
ELSE
Stack EQU 0x00008000
ENDIF

but I get the error:

startup_MSP432P4.s(31): error: A1355U: A Label was found which was in no AREA

I can probably use the --cpreproc option as described here:

www.keil.com/.../armasm_dom1359731170696.htm

but this is more complication than I want to add to my project, especially for something so simple.

Is it possible to do what I want?

Thanks,
Samuel

Parents
  • And didn't you see any pattern in this?

    If you had a label without indentation, you didn't get an error.
    If you had a label with indentation you did get an error.

    If you had your "IF" without indentation, you did get an error.
    If you had your "IF" with indentation, you did not get an error.

    So any reason why you didn't test the combination where you did not indent any label but did indent your "IF"?

    You did keep track of the line numbers for the error messages, and correlated with actual lines in your assembler file?

    And any reason why you didn't look through the assembler manual what rules there might be for white space?

    Or followed my suggestion and looked at Keil's sample startup files?

    As a developer, you need to analyze clues. And you need to consider what available sources you have of examples and documentation. Then you combine the available information and make own conclusions that you can then test. "Programming by forum requests" is a quite slow route - and not a route companies wants to pay salary for.

Reply
  • And didn't you see any pattern in this?

    If you had a label without indentation, you didn't get an error.
    If you had a label with indentation you did get an error.

    If you had your "IF" without indentation, you did get an error.
    If you had your "IF" with indentation, you did not get an error.

    So any reason why you didn't test the combination where you did not indent any label but did indent your "IF"?

    You did keep track of the line numbers for the error messages, and correlated with actual lines in your assembler file?

    And any reason why you didn't look through the assembler manual what rules there might be for white space?

    Or followed my suggestion and looked at Keil's sample startup files?

    As a developer, you need to analyze clues. And you need to consider what available sources you have of examples and documentation. Then you combine the available information and make own conclusions that you can then test. "Programming by forum requests" is a quite slow route - and not a route companies wants to pay salary for.

Children