Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit 21eed91

Browse files
committed
Merge pull request #291 from smaillet-ms/Fix-RTX-Build
Fixed MCBSTM32F400 networking build with latest CMSIS-RTX
2 parents 54fdabc + 4ab5db6 commit 21eed91

File tree

7 files changed

+933
-45
lines changed

7 files changed

+933
-45
lines changed

DeviceCode/Targets/OS/CMSIS_RTOS/CpuOsIrq.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ class CriticalSection
3535
{
3636
public:
3737
CriticalSection( )
38-
: Owner( NoOwner )
38+
: osMutexInitMember( MutexDef )
39+
, MutexId( 0 )
40+
, Owner( NoOwner )
3941
, RefCount( 0 )
4042
{
41-
osMutexInitMember( MutexDef );
43+
osMutexConstructMember( MutexDef );
4244
MutexId = osMutexCreate( osMutex( MutexDef ) );
43-
ASSERT( MutexId != NULL);
45+
ASSERT( MutexId != NULL);
4446
}
4547

4648
void lock( )

DeviceCode/Targets/OS/CMSIS_RTOS/DeviceCode/lwip_1_4_1_os/arch/mutex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ namespace std
1212
{
1313
public:
1414
recursive_mutex( )
15+
: MutexId( 0 )
16+
, osMutexInitMember( MutexDef )
1517
{
16-
osMutexInitMember( MutexDef );
18+
osMutexConstructMember( MutexDef );
1719
MutexId = osMutexCreate( osMutex( MutexDef ) );
1820
}
1921

DeviceCode/Targets/OS/CMSIS_RTOS/DeviceCode/lwip_1_4_1_os/arch/sysarch_timeout.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ namespace lwIP
1414
{
1515
namespace SysArch
1616
{
17-
typedef void (*TimerCallback) (void const *);
18-
17+
typedef void (*TimerCallback) (void const *);
18+
1919
const uint64_t SystemTimeUnitsPerMicrosecond = 10; // HAL system time is in 100ns intervals
2020
const uint64_t SystemTimeUnitsPerMillisecond = 1000 * SystemTimeUnitsPerMicrosecond;
2121

@@ -36,7 +36,7 @@ namespace lwIP
3636
template< typename OsTimerT >
3737
class TimeoutCompare
3838
{
39-
public:
39+
public:
4040
// Compare this Timeout with the specified handler and arg
4141
// returns 0 if equal, negative value if this instance is less
4242
// and 1 if this instance is greater.
@@ -49,7 +49,7 @@ namespace lwIP
4949
{
5050
return Compare( lhs, rhs.get_Handler(), rhs.get_Arg() );
5151
}
52-
52+
5353
static int Compare( const OsTimerT& lhs, TimerCallback handler, void* arg )
5454
{
5555
if( handler < lhs.get_Handler() )
@@ -81,7 +81,7 @@ namespace lwIP
8181
Timeout( sys_timeout_handler handler, void* arg )
8282
: OsTimer( reinterpret_cast<TimerCallback>(handler), arg )
8383
{
84-
this->Initialize();
84+
this->Initialize();
8585
}
8686

8787
// To prevent the timer from triggering and attempting to call a partially

DeviceCode/Targets/OS/CMSIS_RTOS/cmsis_os_cpp.h

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
#define CMSIS_VERSION(m,mm) ( ( ( m )<< 16 ) | ( mm ) )
77

88
#if osCMSIS < CMSIS_VERSION(1, 2)
9-
#error "Unsupported CMSIS version: This header requires a CMSIS implementation with at least version 1.2"
9+
#error "Unsupported CMSIS version: This header requires a CMSIS-RTOS API implementation with at least version 1.2"
1010
#endif
1111

12-
#if osCMSIS_RTX < CMSIS_VERSION(4, 75)
12+
#if !defined(osCMSIS_RTX) || osCMSIS_RTX != CMSIS_VERSION(4, 78)
1313
// unfortunately the implementation of the osXxxxDef and other similar macros
1414
// are implementation defined and, at least for CMSIS-RTX cannot be used to
1515
// declare a C++ data member. Thus, this header is specific to a particular
1616
// version of CMSIS-RTX and requires re-evaluation and verification on any
17-
// later versions.
18-
#error "Unsupported CMSIS-RTOS implementation: This header requires the CMSIS-RTX implementation of CMSIS-RTOS with version 4.75"
17+
// other versions. The structures can and have changed even on minor version
18+
// changes, so the check here is for an exact match on the supported version.
19+
#error "Unsupported CMSIS-RTOS implementation: This header requires the CMSIS-RTX v4.78 implementation of the CMSIS-RTOS API"
1920
#endif
2021

2122
// The following two fields are culled from the CMSIS-RTX header implementation
@@ -25,31 +26,41 @@
2526
uint32_t os_mutex_cb_##name[4]; /* = { 0 }; */\
2627
osMutexDef_t os_mutex_def_##name/* = { (os_mutex_cb_##name) }*/
2728

28-
// This variant of the standard CMSIS-RTOS macro allows use as a member initializer
29-
// list for a constructor.
29+
// This macro is used in the C++ class constructor initializer list to create
30+
// default initialized members
3031
#define osMutexInitMember( name )\
32+
os_mutex_cb_##name()\
33+
,os_mutex_def_##name()
34+
35+
// This variant of the standard CMSIS-RTOS macro constructs a member
36+
// since a standard constructor isn't available.
37+
#define osMutexConstructMember( name )\
3138
memset( &os_mutex_cb_##name, 0, sizeof( os_mutex_cb_##name ) );\
3239
memset( &os_mutex_def_##name, 0, sizeof( os_mutex_def_##name ) );\
3340
os_mutex_def_##name.mutex = &os_mutex_cb_##name
3441

42+
// This macor is used to define a timer instance as a member of a class or struct
3543
#define osTimerDefMember( name )\
36-
uint32_t os_timer_cb_##name[5]; /* = { 0 }*/\
44+
uint32_t os_timer_cb_##name[6]; /* = { 0 }*/\
3745
osTimerDef_t os_timer_def_##name /* = { (function), (os_timer_cb_##name) }*/
3846

47+
// This macro is used in the C++ class constructor initializer list to create
48+
// initialized members
3949
#define osTimerInitMember( name )\
4050
os_timer_cb_##name()\
4151
,os_timer_def_##name()
4252

4353
// ARMCC 5.04 and earlier don't support C++11 initializer list syntax for member initialization
4454
// Therefore, this is used in the constructor to set the internal members as needed.
4555
#define osTimerConstructMember( name, function )\
56+
memset( &os_timer_cb_##name, 0, sizeof( os_timer_cb_##name ) );\
4657
os_timer_def_##name.ptimer = function;\
4758
os_timer_def_##name.timer = &os_timer_cb_##name
4859

4960
namespace MsOpenTech
5061
{
5162
namespace CMSIS_RTOS
52-
{
63+
{
5364
class Timer
5465
{
5566
public:
@@ -69,7 +80,7 @@ namespace MsOpenTech
6980
void Start( uint32_t initialTimeout, bool periodic )
7081
{
7182
TimerId = osTimerCreate( osTimer(TimerDef), periodic ? osTimerPeriodic : osTimerOnce, CallbackArg );
72-
osTimerStart(TimerId, initialTimeout);
83+
osTimerStart(TimerId, initialTimeout);
7384
}
7485

7586
// C++11 move semantics not supported in the ARM compiler 5.04 and earlier

Solutions/MCBSTM32F400/TinyCLR/scatterfile_tinyclr_mdk.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
<FileMapping Name="*" Options="(VectorTable +FIRST)" />
115115
</ExecRegion>
116116

117-
<ExecRegion Name="ER_RAM_RW" Base="+0" Options="ABSOLUTE" Size="">
117+
<ExecRegion Name="ER_RAM_RW" Base="+0" Options="ABSOLUTE NOCOMPRESS" Size="">
118118
<FileMapping Name="*" Options="(+RW-DATA, +ZI)" />
119119
</ExecRegion>
120120

0 commit comments

Comments
 (0)