Compiling to different board types

Hi !
I would like to compile and run the same Dyn C app for different boards.

old BL2010, BL4S150/BL4S160, BLS4200 (core RCM4310) and RCM4300

Using 9.62 for the old BL2010 and 10.64 for the 4000-cores
Problem is that the defines (RCM4300 etc) do not work correctly.
If my target is RCM4300:

  • RCM4300, RCM4310 are true
    if BL4S200:
  • RCM4300, RCM4310 are true
    if BL4S150
  • RCM4300, RCM4310,BL4S150 are true !
    What is the correct way to distinguish those board types ?
    Here is my test app to demonstrate this, on BL4S150 I get all prints !

#use “boardtypes.lib” // I use this don’t know if it is needed or not
int main()
{
#ifndef BOARD_TYPE //Compiling Dyn C 9.62
#define BL2010 1
printf("I am BL2010
");
#endif
//otherwise using Dyn C 10.64
// prints BLS4150=12034,RCM4300=10752,BL4S200=10753
printf("Board type %d
", BOARD_TYPE);

#ifdef BL4S150 || BL4S160
// #use “BL4S1xx.lib”
printf("I am BL4S150/BL4S160
");
#endif

#ifdef RCM4310
#define BL4S200
// #use “BLxS2xx.lib”
printf("I am BL4S200 or RCM4310
");
#endif
#ifdef RCM4300
// #use “RCM43xx.lib”
printf("I am RCM4300
");
#endif
#ifdef RCM4300 || RCM4310
// #use “sdflash.lib”
printf("Using SD card
");
#endif
}

The way I use the defines is to check against the _BOARD_TYPE for specific models (although for the BLXS200 series you also have to involve the BLXS200_SERIES macro).

The following is from the device initialisation code in the device object for the BACnet stack to set unique names based on the board being used:


#if BLXS200_SERIES
#if BOARD_TYPE == RCM4010
_f_strcpy(Object_Name, “BL4S210 Test Device”);
Device_Set_Object_Instance_Number(4210);
Device_Set_Model_Name(“BL4S210”, 7);
#elif BOARD_TYPE == RCM4310
_f_strcpy(Object_Name, “BL4S200 Test Device”);
Device_Set_Object_Instance_Number(4200);
Device_Set_Model_Name(“BL4S200”, 7);
#elif BOARD_TYPE == RCM4510W
_f_strcpy(Object_Name, “BL4S230 Test Device”);
Device_Set_Object_Instance_Number(4230);
Device_Set_Model_Name(“BL4S230”, 7);
#elif BOARD_TYPE == RCM5400W
_f_strcpy(Object_Name, “BL5S220 Test Device”);
Device_Set_Object_Instance_Number(5220);
Device_Set_Model_Name(“BL5S220”, 7);
#else
_f_strcpy(Object_Name, “BL?S2?? Test Device”);
Device_Set_Object_Instance_Number(4201);
Device_Set_Model_Name(“BL?S2??”, 7);
#endif
#elif BOARD_TYPE == BL4S100
_f_strcpy(Object_Name, “BL4S100 Test Device”);
Device_Set_Object_Instance_Number(4100);
Device_Set_Model_Name(“BL4S100”, 7);
#elif BOARD_TYPE == BL4S110
_f_strcpy(Object_Name, “BL4S110 Test Device”);
Device_Set_Object_Instance_Number(4110);
Device_Set_Model_Name(“BL4S110”, 7);
#elif BOARD_TYPE == BL4S150
_f_strcpy(Object_Name, “BL4S150 Test Device”);
Device_Set_Object_Instance_Number(4150);
Device_Set_Model_Name(“BL4S150”, 7);
#elif BOARD_TYPE == BL4S160
_f_strcpy(Object_Name, “BL4S160 Test Device”);
Device_Set_Object_Instance_Number(4160);
Device_Set_Model_Name(“BL4S160”, 7);
#elif BOARD_TYPE == RCM5600W
_f_strcpy(Object_Name, “RCM5600W Test Device”);
Device_Set_Object_Instance_Number(5600);
Device_Set_Model_Name(“RCM5600W”, 8);
#elif BOARD_TYPE == RCM5650W
_f_strcpy(Object_Name, “RCM5650W Test Device”);
Device_Set_Object_Instance_Number(5650);
Device_Set_Model_Name(“RCM5650W”, 8);
#elif BOARD_TYPE == RCM5700
_f_strcpy(Object_Name, “RCM5700 Test Device”);
Device_Set_Object_Instance_Number(5700);
Device_Set_Model_Name(“RCM5700”, 7);
#elif BOARD_TYPE == RCM5710
_f_strcpy(Object_Name, “RCM5710 Test Device”);
Device_Set_Object_Instance_Number(5710);
Device_Set_Model_Name(“RCM5710”, 7);
#elif BOARD_TYPE == RCM5750
_f_strcpy(Object_Name, “RCM5750 Test Device”);
Device_Set_Object_Instance_Number(5750);
Device_Set_Model_Name(“RCM5750”, 7);
#elif BOARD_TYPE == RCM5760
_f_strcpy(Object_Name, “RCM5760 Test Device”);
Device_Set_Object_Instance_Number(5760);
Device_Set_Model_Name(“RCM5760”, 7);
#elif BOARD_TYPE == RCM6700
_f_strcpy(Object_Name, “RCM6700 Test Device”);
Device_Set_Object_Instance_Number(6700);
Device_Set_Model_Name(“RCM6700”, 7);
#elif BOARD_TYPE == RCM6710
_f_strcpy(Object_Name, “RCM6710 Test Device”);
Device_Set_Object_Instance_Number(6710);
Device_Set_Model_Name(“RCM6710”, 7);
#elif BOARD_TYPE == RCM6750
_f_strcpy(Object_Name, “RCM6750 Test Device”);
Device_Set_Object_Instance_Number(6750);
Device_Set_Model_Name(“RCM6750”, 7);
#elif BOARD_TYPE == RCM6760
_f_strcpy(Object_Name, “RCM6760 Test Device”);
Device_Set_Object_Instance_Number(6760);
Device_Set_Model_Name(“RCM6760”, 7);
#elif BOARD_TYPE == XG4100
_f_strcpy(Object_Name, “XG4100/XG4500 Test Device”);
Device_Set_Object_Instance_Number(4500);
Device_Set_Model_Name(“XG4100/XG4500”, 13);
#else
_f_strcpy(Object_Name, “Unknown Device”);
Device_Set_Object_Instance_Number(12345);
Device_Set_Model_Name(“Unknown”, 7);
#endif


Hope this helps.

Regards,
Peter