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 Includes in Assembler

Hi all,

I'm working on a project using the Keil C51 assembler on a Silicon Labs EFM8BB2 project. We're trying to port it to a BB1 (now that we have most of the features coded and the code is undergoing compression to fit), but I'd like it to conditionally build for either platform.

What I currently have in an assembly file (the RAM test function) is the following:

$IF (BB2 == 1)
;$include (SI_EFM8BB2_Defs.inc) ; SFR declarations
$ELSE
$include (SI_EFM8BB1_Defs.inc) ; SFR declarations
$ENDIF

"BB2" or "BB1" is defined for the specific build. For the Debug version, I'd like to leave it as BB2, because the debug code adds a bunch of extra functionality: mostly putting strings out through the UART port. (Most of the extra is actually storage of the strings themselves.)

My problem is that if I uncomment the "BB2" include, the "BB1" build fails because it can't find the SFR file. (I also set the include paths according to the BB1/BB2 status.)
I should add that vice-versa applies.

I have just done an apparently successful build with both uncommented by adding include paths for both SFR files. This builds from the SiLabs IDE, but the command line build by our CI system fails. I'm still trying to track that failure mode down.

Question: Is there a way to do the conditional include in the C51 assembler without having to add both include paths?

Thanks,

Geoff