Skip to content

Commit

Permalink
Improvements in device information
Browse files Browse the repository at this point in the history
- Add CompilerInfo to SoftwareVersionProperties
- Increase size of ReleaseInfo.Info string
- Rename fields in SoftwareVersion and ReleaseInfo
- Add ChibiOS version and mention to ChibiOS to HAL info string on all reference targets

Signed-off-by: José Simões <jose.simoes@eclo.solutions>
  • Loading branch information
josesimoes committed Jan 4, 2018
1 parent c57666c commit a642e9e
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 40 deletions.
26 changes: 19 additions & 7 deletions src/CLR/Debugger/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -967,12 +967,12 @@ static void GetClrReleaseInfo(CLR_DBG_Commands::Debugging_Execution_QueryCLRCapa

void NFReleaseInfo::Init(NFReleaseInfo& NFReleaseInfo, unsigned short int major, unsigned short int minor, unsigned short int build, unsigned short int revision, const char *info, size_t infoLen)
{
NFVersion::Init( NFReleaseInfo.version, major, minor, build, revision );
NFReleaseInfo.infoString[ 0 ] = 0;
NFVersion::Init( NFReleaseInfo.Version, major, minor, build, revision );
NFReleaseInfo.InfoString[ 0 ] = 0;
if ( NULL != info && infoLen > 0 )
{
const size_t len = MIN(infoLen, sizeof(NFReleaseInfo.infoString)-1);
hal_strncpy_s( (char*)&NFReleaseInfo.infoString[ 0 ], sizeof(NFReleaseInfo.infoString), info, len );
const size_t len = MIN(infoLen, sizeof(NFReleaseInfo.InfoString)-1);
hal_strncpy_s( (char*)&NFReleaseInfo.InfoString[ 0 ], sizeof(NFReleaseInfo.InfoString), info, len );
}
}

Expand All @@ -991,6 +991,15 @@ bool CLR_DBG_Debugger::Debugging_Execution_QueryCLRCapabilities( WP_Message* msg
int size = 0;
bool fSuccess = true;

// set the compiler info string here
#if defined(__GNUC__)
#define COMPILER_INFO "GNU ARM GCC"
const size_t len = MIN(sizeof(COMPILER_INFO), sizeof(reply.u_SoftwareVersion.CompilerInfo)-1);
#else
#define COMPILER_INFO "UNKNOWN"
const size_t len = 0;
#endif

memset(&reply, 0, sizeof(reply));

switch(cmd->m_cmd)
Expand Down Expand Up @@ -1048,16 +1057,19 @@ bool CLR_DBG_Debugger::Debugging_Execution_QueryCLRCapabilities( WP_Message* msg
#if defined(__GNUC__)
// this is returning the GNU GCC compiler version in coded format: MAJOR x 10000 + MINOR x 100 + PATCH
// example: v6.3.1 shows as 6 x 10000 + 3 x 100 + 1 = 60301
reply.u_SoftwareVersion.m_compilerVersion = (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__);
reply.u_SoftwareVersion.CompilerVersion = (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__);
#else
reply.u_SoftwareVersion.m_compilerVersion = -1;
reply.u_SoftwareVersion.CompilerVersion = -1;
#endif

#if defined(__DATE__)
hal_strncpy_s( reply.u_SoftwareVersion.m_buildDate, sizeof(reply.u_SoftwareVersion.m_buildDate), __DATE__, hal_strlen_s(__DATE__) );
hal_strncpy_s( reply.u_SoftwareVersion.BuildDate, sizeof(reply.u_SoftwareVersion.BuildDate), __DATE__, hal_strlen_s(__DATE__) );
#else
#error "__DATE__ with build timestamp needs to be defined"
#endif

hal_strncpy_s( (char*)&reply.u_SoftwareVersion.CompilerInfo[ 0 ], sizeof(reply.u_SoftwareVersion.CompilerInfo), COMPILER_INFO, len );

data = (CLR_UINT8*)&reply.u_SoftwareVersion;
size = sizeof(reply.u_SoftwareVersion);
break;
Expand Down
8 changes: 4 additions & 4 deletions src/CLR/Debugger/Debugger_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ __nfweak void CLR_DBG_Debugger::BroadcastEvent( unsigned int cmd, unsigned int p

__nfweak void NFReleaseInfo::Init( NFReleaseInfo& NFReleaseInfo, unsigned short int major, unsigned short int minor, unsigned short int build, unsigned short int revision, const char *info, size_t infoLen )
{
NFVersion::Init( NFReleaseInfo.version, major, minor, build, revision );
NFReleaseInfo.infoString[ 0 ] = 0;
NFVersion::Init( NFReleaseInfo.Version, major, minor, build, revision );
NFReleaseInfo.InfoString[ 0 ] = 0;
if ( NULL != info && infoLen > 0 )
{
const size_t len = MIN(infoLen, sizeof(NFReleaseInfo.infoString)-1);
hal_strncpy_s( (char*)&NFReleaseInfo.infoString[0], sizeof(NFReleaseInfo.infoString), info, len );
const size_t len = MIN(infoLen, sizeof(NFReleaseInfo.InfoString)-1);
hal_strncpy_s( (char*)&NFReleaseInfo.InfoString[0], sizeof(NFReleaseInfo.InfoString), info, len );
}
}
5 changes: 3 additions & 2 deletions src/CLR/Include/nanoCLR_Debugging.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,9 @@ struct CLR_DBG_Commands

struct __nfpack SoftwareVersion
{
char m_buildDate[ 22 ];
unsigned int m_compilerVersion;
char BuildDate[ 22 ];
char CompilerInfo[16];
unsigned int CompilerVersion;
};

struct __nfpack ClrInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ HRESULT Library_nf_rt_native_nanoFramework_Runtime_Hardware_SystemInfo::GetSyste

Target_GetReleaseInfo( releaseInfo );

hbMajor.SetInteger( releaseInfo.version.usMajor );
hbMajor.SetInteger( releaseInfo.Version.usMajor );
NANOCLR_CHECK_HRESULT(hbMajor.StoreToReference( stack.Arg0(), 0 ));

hbMinor.SetInteger( releaseInfo.version.usMinor );
hbMinor.SetInteger( releaseInfo.Version.usMinor );
NANOCLR_CHECK_HRESULT(hbMinor.StoreToReference( stack.Arg1(), 0 ));

hbBuild.SetInteger( releaseInfo.version.usBuild );
hbBuild.SetInteger( releaseInfo.Version.usBuild );
NANOCLR_CHECK_HRESULT(hbBuild.StoreToReference( stack.Arg2(), 0 ));

hbRevision.SetInteger( releaseInfo.version.usRevision );
hbRevision.SetInteger( releaseInfo.Version.usRevision );
NANOCLR_CHECK_HRESULT(hbRevision.StoreToReference( stack.Arg3(), 0 ));
}

Expand All @@ -50,7 +50,7 @@ HRESULT Library_nf_rt_native_nanoFramework_Runtime_Hardware_SystemInfo::get_OEMS

Target_GetReleaseInfo( releaseInfo );

NANOCLR_SET_AND_LEAVE(stack.SetResult_String( (char*)releaseInfo.infoString ));
NANOCLR_SET_AND_LEAVE(stack.SetResult_String( (char*)releaseInfo.InfoString ));
}

NANOCLR_NOCLEANUP();
Expand Down
4 changes: 2 additions & 2 deletions src/HAL/Include/nanoHAL_ReleaseInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ struct __nfpack NFVersion

struct __nfpack NFReleaseInfo
{
NFVersion version;
unsigned char infoString[64-sizeof(NFVersion)];
NFVersion Version;
unsigned char InfoString[128-sizeof(NFVersion)];

static void Init(NFReleaseInfo& releaseInfo, unsigned short major=0, unsigned short minor=0, unsigned short build=0, unsigned short revision=0, const char *info=(const char *)NULL, size_t infoLen=0);
};
Expand Down
12 changes: 6 additions & 6 deletions src/HAL/nanoHAL_SystemInformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ bool GetHalSystemInfo(HalSystemInfo& systemInfo)
#else

// NFReleaseInfo:
systemInfo.m_releaseInfo.version.usMajor = VERSION_MAJOR;
systemInfo.m_releaseInfo.version.usMinor = VERSION_MINOR;
systemInfo.m_releaseInfo.version.usBuild = VERSION_BUILD;
systemInfo.m_releaseInfo.version.usRevision = VERSION_REVISION;
const size_t len = sizeof(systemInfo.m_releaseInfo.infoString);
systemInfo.m_releaseInfo.Version.usMajor = VERSION_MAJOR;
systemInfo.m_releaseInfo.Version.usMinor = VERSION_MINOR;
systemInfo.m_releaseInfo.Version.usBuild = VERSION_BUILD;
systemInfo.m_releaseInfo.Version.usRevision = VERSION_REVISION;
const size_t len = sizeof(systemInfo.m_releaseInfo.InfoString);

hal_strncpy_s ((char*)&systemInfo.m_releaseInfo.infoString[0], len, OEMSYSTEMINFOSTRING, len-1 );
hal_strncpy_s ((char*)&systemInfo.m_releaseInfo.InfoString[0], len, OEMSYSTEMINFOSTRING, len-1 );

// we are not supporting this at this time
// OEM_MODEL_SKU:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#define _TARGET_BOARD_NANOBOOTER_H_

#include <target_common.h>
#include <chversion.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! Running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoBooter running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOBOOTER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

#include <target_common.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! CLR running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoCLR running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOCLR_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#define _TARGET_BOARD_NANOBOOTER_H_

#include <target_common.h>
#include <chversion.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! Running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoBooter running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOBOOTER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

#include <target_common.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! CLR running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoCLR running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOCLR_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#define _TARGET_BOARD_NANOBOOTER_H_

#include <target_common.h>
#include <chversion.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES!! Booter Running @ @CHIBIOS_BOARD@"
#define OEMSYSTEMINFOSTRING "nanoBooter running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOBOOTER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

#include <target_common.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES!! CLR running @ @CHIBIOS_BOARD@"
#define OEMSYSTEMINFOSTRING "nanoCLR running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOCLR_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#define _TARGET_BOARD_NANOBOOTER_H_

#include <target_common.h>
#include <chversion.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! Running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoBooter running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOBOOTER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

#include <target_common.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! CLR running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoCLR running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOCLR_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#define _TARGET_BOARD_NANOBOOTER_H_

#include <target_common.h>
#include <chversion.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! Running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoBooter running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOBOOTER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

#include <target_common.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! CLR running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoCLR running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOCLR_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#define _TARGET_BOARD_NANOBOOTER_H_

#include <target_common.h>
#include <chversion.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! Running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoBooter running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOBOOTER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

#include <target_common.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES! CLR running @ @CHIBIOS_BOARD@ "
#define OEMSYSTEMINFOSTRING "nanoCLR running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOCLR_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#define _TARGET_BOARD_NANOBOOTER_H_

#include <target_common.h>
#include <chversion.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES!! Booter Running @ @CHIBIOS_BOARD@"
#define OEMSYSTEMINFOSTRING "nanoBooter running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOBOOTER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#define _TARGET_BOARD_NANOCLR_H_

#include <target_common.h>
#include <chversion.h>

#define OEMSYSTEMINFOSTRING "nanoFramework RULES!! CLR running @ @CHIBIOS_BOARD@"
#define OEMSYSTEMINFOSTRING "nanoCLR running @ @CHIBIOS_BOARD@ built with ChibiOS v" CH_VERSION

#endif /* _TARGET_BOARD_NANOCLR_H_ */

0 comments on commit a642e9e

Please sign in to comment.