Closed LDong-Arm closed 4 years ago
@ithinuel @ashok-rao @evedon @MarceloSalazar This is one of the two PRs to fix the AWS example with the Arm Compiler, would you please have a look? Thanks. (I don't have permission to add reviewers.)
@ashok-rao I've updated README to include how to enable Defender.
@ithinuel @ashok-rao Just added another fix - we need to use localtime()
instead of gmtime()
(unsupported by the Arm Compiler). Also, local time is the time format used by AWS's official POSIX implementation...
Ready for merge @ithinuel ?
It still works for me with GCC. If @gpsimenos can confirm it does with ARMC6 I can merge this :)
@ithinuel Now we can merge it? Then I'll update the .lib in ARMmbed/mbed-os-example-aws#7
Part of the fix for https://github.com/ARMmbed/mbed-os-example-aws/issues/3 (Needs https://github.com/ARMmbed/mbed-os-example-aws/pull/7 too)
This PR addresses two issues that prevent the Arm Compiler from building mbed-os-example-aws.
Temporarily disable Defender module
The AWS SDK has a Defender module which requires the porting layer to implement
IotClock_SleepMs
,IotSemaphore_TryWait
andIotMetrics_GetTcpConnections
. For now we haven't provided those yet because mbed-os-example-aws doesn't use Defender at the moment.Users can re-enable Defender by adding the missing implementation. Refer to the updated README.
Use ARMmbed/tinycbor repository for Arm Compiler compatibility
The upstream https://github.com/intel/tinycbor currently doesn't compile with the Arm Compiler:
#include <version>
to use the wrong headerThe fork under ARMmbed has those issues resolved.
Note: Our fork has renamed cbor.h -> tinycbor.h, so we create cbor.h here to maintain compatibility with the AWS SDK.
Fix strftime() nullptr dereference with logging
Logging isn't properly enabled until we apply #3. Now with logging enabled,
IotClock_GetTimestring()
crashes because it usesgmtime()
(which returnsNULL
due to the lack of support by the Arm Compiler's C library) instrftime()
.The fix is using
localtime()
instead - it is also what the AWS SDK uses in its POSIX implementation.