same apps for ConnectMe and ConnectWiMe

Hi to everyone,

I developed an application on a Connect Wi-Me. Now the same application runs correctly also on a Connect Me (after selecting the right device on the my project) but only if I remove all calls to wireless driver functions: I obtain this with a simple preprocessor conditional directive.

I’d like to get the same result automatically: Is it possible to tell the code to include part of it depending on the specific device?

thanks
maumau

Hi,

I am assuming that you mean yo have to manually change the conditional each time you switch to the other device.

If this is the case you need to use one of the predefined definitions rather than your own conditional.

That is use something like
#if NA_BOARD_TYPE == “connectme” as your condition as this symbol is automatically set when you switch platforms in ESP

Maurizio,

One of our engineers came up with the following code that will let you know which platform you are running on. This code will allow you make the determination to execute certain calls based on the platform. Below is an abbreviated root.c file showing how to setup the #define. You may still have to work out any possible build issues.

root.c file:
/* Copyright (c) 1996-2007 Digi International Inc., All Rights Reserved */

#include
#include
#include
#include “appconf.h”
#include “bsp_api.h”
#include “platformCodes.h”

/* build a mask defining my board and processor. We probably do not need to know the board rev adn the amount of memory. */

#define MY_BOARD ((0x80000000) | (BSP_BOARD_SHIFT(BSP_BOARD_NS9360)) | (BSP_PROCESSOR_SHIFT(BSP_PROCESSOR_NS9360)) | (BSP_REVISION_SHIFT(0)) | (BSP_RAM_SHIFT(0)))

/* Function: void applicationStart (void) */

void applicationStart (void)

{
unsigned long myPlatformType = 0;

/* Code to start the user application goes here. */

printf ("Hello World!

");
printf("MY_BOARD is %x
", MY_BOARD);
printf("I am running on a ");
myPlatformType = NABspGetThisPlatformsId();

// use MY_BOARD to mask against what   NABspGetThisPlatformsId returned.
// if myPlatformType is (in my case) an NS9360 processor running on an NS9360
// dev board, then I should get a match. Else, I'll hit the default

switch(myPlatformType & MY_BOARD)
{
    case MY_BOARD:
        printf("NS9360

");
break;
default:
printf("unknown %x
", myPlatformType);
break;
}

printf("end of test

“);
printf(”
");

tx_thread_suspend(tx_thread_identify());

}

Hi rdeabill,

thanks for your answer. Your suggest is nice but if I write

#if NA_BOARD_TYPE == “connectme”

#endif

the builder shows the following error:

error: token ““connectme”” is not valid in preprocessor expressions

do you think about this?

ciao

Hi,

Try
#if (NA_BOARD_TYPE == “connectme”)

#endif

This may work, but I am not quite sure about string comparisons here

Starting with NET+OS version V7.4, the recommended API is as follows:
NABspGetPlatformId(). See bsp\h\platformCodes.h for the returned platform codes.

In the V7.4 and above API reference manual, this is described in:
Hardware/Board Support\Bootloader\Functions\NABspGetPlatformId

Hi,

Unfortunately the preprocessor doesn’t accept string directives and so the line

#if (NA_BOARD_TYPE == “connectwime”)

it’s not correct. I can’t use
NABspGetThisPlatformsId() function because I must determinate the using board at the code
level.

thanks to all