An example project for the Heltec Turtle LoRa board (STM32L4 and SX1276 chips). The projects is only supported for the Nucleo-L432KC board platform in the mbed online and offline compiler environment. Visit www.radioshuttle.de (choose Turtle board) for instructions. Note that most source files and libraries are open source, however some files especially the RadioShuttle core protocol is copyrighted work. Check header for details.

Dependencies:   mbed BufferedSerial SX1276GenericLib OLED_SSD1306 HELIOS_Si7021 NVProperty RadioShuttle-STM32L4 USBDeviceHT

Files at this revision

API Documentation at this revision

Comitter:
Helmut Tschemernjak
Date:
Fri Feb 15 10:48:30 2019 +0100
Parent:
42:6f83ba18bcea
Child:
44:cda7bca43f3b
Commit message:
Moved helper files into Utiles folder to keep it easier for users

Changed in this revision

Utils/arch.cpp Show annotated file Show diff for this revision Revisions of this file
Utils/arch.h Show annotated file Show diff for this revision Revisions of this file
Utils/mbed-util.h Show annotated file Show diff for this revision Revisions of this file
Utils/mbed-util.s Show annotated file Show diff for this revision Revisions of this file
Utils/utils.cpp Show annotated file Show diff for this revision Revisions of this file
arch.cpp Show diff for this revision Revisions of this file
arch.h Show diff for this revision Revisions of this file
mbed-util.h Show diff for this revision Revisions of this file
mbed-util.s Show diff for this revision Revisions of this file
utils.cpp Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/arch.cpp	Fri Feb 15 10:48:30 2019 +0100
@@ -0,0 +1,84 @@
+/*
+ * $Id: $
+ * This is an unpublished work copyright (c) 2019 HELIOS Software GmbH
+ * 30827 Garbsen, Germany
+ */
+#include <mbed.h>
+#include "arch.h"
+
+// --------------------------------------------------------------------------------------------------------------------
+#ifndef TOOLCHAIN_GCC
+
+_extern_c size_t strnlen(const char *s, size_t maxlen) {
+    const char *endp = static_cast<const char *>(memchr(s, 0, maxlen));
+    if (endp == NULL) {
+        return maxlen;
+    } else {
+        return endp - s;
+    }
+}
+
+_extern_c char *strdup(const char *s) {
+    size_t sz = strlen(s) + 1;
+    char *news = static_cast<char *>(malloc(sz));
+    if (news) {
+        memcpy(news, s, sz);
+    }
+    return news;
+}
+
+// _extern_c char *stpcpy(char *dest, const char *src) {
+//     size_t l = strlen(src);
+//     memcpy(dest, src, l+1);
+//     return dest + l;
+// }
+
+#endif
+
+// --------------------------------------------------------------------------------------------------------------------
+#ifdef TARGET_STM32L0
+#ifdef TOOLCHAIN_GCC
+_extern_c unsigned int __atomic_fetch_or_4(volatile void *mem, unsigned int val, int model) {
+    volatile unsigned int *ptr = static_cast<volatile unsigned int *>(mem);
+    core_util_critical_section_enter();
+    unsigned int tmp = *ptr;
+    *ptr = tmp | val;
+    core_util_critical_section_exit();
+    return tmp;
+}
+
+_extern_c unsigned int __atomic_exchange_4(volatile void *mem, unsigned int val, int model) {
+    volatile unsigned int *ptr = static_cast<volatile unsigned int *>(mem);
+    core_util_critical_section_enter();
+    unsigned int tmp = *ptr;
+    *ptr = val;
+    core_util_critical_section_exit();
+    return tmp;
+}
+
+#else
+_extern_c bool __user_cmpxchg_1(unsigned char *ptr, unsigned char oldp, unsigned char newp)
+{
+    return !core_util_atomic_cas_u8(ptr, &oldp, newp);
+//     core_util_critical_section_enter();
+//     bool r = (*ptr == oldp);
+//     if (r) {
+//         *ptr = newp;
+//     }
+//     core_util_critical_section_exit();
+//     return !r;
+}
+
+_extern_c bool __user_cmpxchg_4(unsigned int *ptr, unsigned int oldp, unsigned int newp)
+{
+    return !core_util_atomic_cas_u32(ptr, &oldp, newp);
+//     core_util_critical_section_enter();
+//     bool r = (*ptr == oldp);
+//     if (r) {
+//         *ptr = newp;
+//     }
+//     core_util_critical_section_exit();
+//     return !r;
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/arch.h	Fri Feb 15 10:48:30 2019 +0100
@@ -0,0 +1,319 @@
+/*
+ * $Id: config.h,v 1.5 2017/02/23 14:31:38 grimrath Exp $
+ * This is an unpublished work copyright (c) 2019 HELIOS Software GmbH
+ * 30827 Garbsen, Germany
+ */
+#ifndef __ARCH_H__
+#define __ARCH_H__
+
+#ifdef __cplusplus
+#define _extern_c extern "C"
+#else
+#define _extern_c
+#endif
+
+// --------------------------------------------------------------------------------------------------------------------
+// Definitions to adapt between POSIX and MBED
+//
+#ifdef __MBED__
+
+#include <mbed_assert.h>
+#include <mbed_debug.h>
+
+#ifdef TARGET_DEBUG
+#define DEBUG 1
+#define STATIC_ASSERT	MBED_STATIC_ASSERT
+#define ASSERT		MBED_ASSERT
+#else
+#define ASSERT(x)	((void)0)
+#endif
+
+#define STATIC_ASSERT	MBED_STATIC_ASSERT
+
+#ifndef TOOLCHAIN_GCC
+#ifdef __cplusplus
+using std::size_t;
+using std::va_list;
+using std::abort;
+#endif
+
+_extern_c size_t strnlen(const char *s, size_t maxlen);
+_extern_c char *strdup(const char *s);
+_extern_c char *stpcpy(char *dest, const char *src);
+
+#endif
+
+struct iovec {
+    void *  iov_base;
+    size_t  iov_len;
+};
+
+
+static inline unsigned read_systicker_us(void) {
+	extern uint32_t us_ticker_read(void);	// I do not want to include us_ticker_api.h here
+
+	return us_ticker_read();
+}
+
+#define FlashFileSysMount	"Flash"
+// #define ESPFileSysMount     "ESP"
+#define PseudoFileSysMount	"pseudo"
+
+#else // __MBED__
+
+#include <assert.h>
+#include <time.h>
+
+#ifdef __cplusplus
+#define STATIC_ASSERT(condition, msg) ((void)sizeof(char[1 - 2*!(condition)]))
+#else
+#define STATIC_ASSERT(expr, msg)	_Static_assert(expr, msg)  // C11 feature
+#endif
+#define ASSERT				assert
+
+//static inline unsigned read_systicker_us(void) {
+//	struct timespec ts;
+//	clock_gettime(CLOCK_MONOTONIC, &ts);
+//	return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000);
+//}
+
+#endif // __MBED__
+
+
+// --------------------------------------------------------------------------------------------------------------------
+// synchronize memory contents with external peripherals and interrupt handlers
+//
+// __ATOMIC_RELAXED should be ok since we are only dealing with irq handlers on exactly one CPU/MCU
+//
+// __atomic_load_n is not available in the online IDE (yet)
+//
+#if defined(__ATOMIC_RELAXED)
+
+#define help_atomic_load_relaxed(ptr) __atomic_load_n((ptr), __ATOMIC_RELAXED)
+
+#define help_atomic_store_relaxed(ptr, val) __atomic_store_n((ptr), (val), __ATOMIC_RELAXED)
+
+#define help_atomic_readclr_relaxed(ptr) __atomic_exchange_n((ptr), 0, __ATOMIC_RELAXED)
+
+#define help_atomic_or_relaxed(ptr, val) __atomic_fetch_or((ptr), (val), __ATOMIC_RELAXED)
+
+#ifdef __cplusplus
+template<typename T> inline bool help_atomic_compare_and_swap(T *ptr, T checkval, T newval) {
+    return __atomic_compare_exchange_n(ptr, &checkval, newval, false, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+}
+#else
+#define help_atomic_compare_and_swap(ptr, checkval, newval) __sync_bool_compare_and_swap((ptr), (checkval), (newval))
+#endif
+
+#define sync_memory(mem) do { \
+	asm volatile("" : "=m" (mem)); \
+	__atomic_thread_fence(__ATOMIC_SEQ_CST); \
+} while (0)
+
+#define irq_barrier() __atomic_signal_fence(__ATOMIC_SEQ_CST)
+
+#define sync_memory_all() do { \
+	asm volatile("" : : : "memory"); \
+	__atomic_thread_fence(__ATOMIC_SEQ_CST); \
+} while (0)
+
+#else // defined(__ATOMIC_RELAXED)
+
+#define help_atomic_load_relaxed(ptr) (*(ptr))
+
+#define help_atomic_store_relaxed(ptr, val) ((void)(*(ptr) = (val)))
+
+#define help_atomic_readclr_relaxed(ptr) __sync_fetch_and_and((ptr), 0)
+
+#define help_atomic_or_relaxed(ptr, val) __sync_fetch_and_or((ptr), (val))
+
+#define help_atomic_compare_and_swap(ptr, checkval, newval) __sync_bool_compare_and_swap((ptr), (checkval), (newval))
+
+#define sync_memory(mem) __sync_synchronize()
+
+#define sync_memory_all() __sync_synchronize()
+
+#define irq_barrier() __sync_synchronize()
+
+#endif
+
+
+#define help_atomic_init(ptr, initval) do { *(ptr) = (initval); } while (0)
+
+// --------------------------------------------------------------------------------------------------------------------
+// other
+
+#define ispowerof2(x) (((x) & ((x) - 1)) == 0)
+
+static inline uint32_t alignup32(uint32_t size, uint32_t next) {
+    uint32_t next1 = next - 1;
+    ASSERT((next & next1) == 0);	// 2^n check
+    return (size + next1) & ~next1;
+}
+
+
+// --------------------------------------------------------------------------------------------------------------------
+// typesafe macros to get the number of compile-time known array elements.
+//
+#ifdef __cplusplus
+
+template< typename T, std::size_t N > char(&COUNTOF_REQUIRES_ARRAY_ARGUMENT(T(&)[N]))[N];
+#define ARRAYLEN(x) sizeof(COUNTOF_REQUIRES_ARRAY_ARGUMENT(x))
+
+#else
+
+// MBED OS online compiler does not support unnamed and zero sized bitfields as GCC does
+// #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))	// used by Linux kernel
+#define __must_be_zero(e) (sizeof(struct { char dummy:(1 - 2*!!(e)); }) - 1)
+
+// __builtin_types_compatible_p: gcc extension, but understood by Intel, clang and ARM compilers too
+// __builtin_types_compatible_p is not available in C++
+#define __must_be_array(arr) __must_be_zero(__builtin_types_compatible_p(typeof(arr), typeof(&(arr)[0])))
+
+#define ARRAYLEN(arr) (sizeof(arr) / sizeof(0[arr])) + __must_be_array(arr)
+
+#endif
+
+
+// --------------------------------------------------------------------------------------------------------------------
+// quick int32 -> int conversion mainly for printf. Shorter than static_cast<int> and works with C too.
+//
+static inline int itoi(int val) { return val; }
+static inline long long lltoll(long long val) { return val; }
+
+
+// --------------------------------------------------------------------------------------------------------------------
+// Byte order
+//
+#ifdef __MBED__
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+static inline uint16_t htole16(uint16_t x) { return x; }
+static inline uint16_t le16toh(uint16_t x) { return x; }
+static inline uint32_t htole32(uint32_t x) { return x; }
+static inline uint32_t le32toh(uint32_t x) { return x; }
+
+#else
+
+// unused big endian variants
+// static inline uint16_t htobe16(uint16_t x) { return __REV16(x); }
+// static inline uint16_t be16toh(uint16_t x) { return __REV16(x); }
+// static inline uint32_t htobe32(uint32_t x) { return __REV(x); }
+// static inline uint32_t be32toh(uint32_t x) { return __REV(x); }
+
+#endif
+
+#elif defined(__linux__)
+
+#include <endian.h>
+
+#elif defined(__APPLE__)
+
+#include <libkern/OSByteOrder.h>
+#define htole16 OSSwapHostToLittleInt16
+#define le16toh OSSwapHostToLittleInt16
+#define htole32 OSSwapHostToLittleInt32
+#define le32toh OSSwapHostToLittleInt32
+
+#endif
+
+
+// --------------------------------------------------------------------------------------------------------------------
+// memory debugging
+//
+#ifdef DEBUG
+
+#ifdef USE_VALGRIND
+
+#include <valgrind/valgrind.h>
+#include <valgrind/memcheck.h>
+#include <string.h>
+
+#define CHECKDEFINED(obj) VALGRIND_CHECK_MEM_IS_DEFINED(&(obj), sizeof(obj))
+
+#endif // ! valgrind
+
+static inline void POISONMEM(void *ptr, size_t sz) {
+	memset(ptr, 0x55, sz);
+#ifdef USE_VALGRIND
+	VALGRIND_MAKE_MEM_UNDEFINED(ptr, sz);
+#endif
+}
+
+#define POISON(obj) POISONMEM(&(obj), sizeof(obj))
+
+#else // ! DEBUG
+
+#ifdef USE_VALGRIND
+#error valgrind features only useable in debug builds
+#endif
+
+static inline void POISONMEM(void *ptr, size_t sz) { (void)ptr; (void)sz; }
+
+#define POISON(obj)	((void)0)
+
+#endif // DEBUG
+
+// --------------------------------------------------------------------------------------------------------------------
+// Macros to live bookmark code
+//
+#ifdef DEBUG
+
+_extern_c void dbg_fail_handler(const char *file, int line, const char *func, const char *msg) __attribute__((noreturn));
+
+#define TODO(...)	dbg_fail_handler(__FILE__, __LINE__, __func__, "TODO" __VA_ARGS__)
+#define UNTESTED()	dbg_fail_handler(__FILE__, __LINE__, __func__, "UNTESTED")
+#define UNREACHABLE()	dbg_fail_handler(__FILE__, __LINE__, __func__, "UNREACHABLE")
+#if defined(__x86_64__) || defined(__i386__)
+#define BREAKPOINT()	asm("int $3")
+#elif defined(__arm__)
+#define BREAKPOINT()	__BKPT(0)
+#else
+#error no compile time breakpoints supplied for this architecture - add them if needed
+#endif
+
+#else // ! debug
+
+#define TODO(...)	abort()
+#define UNTESTED()	((void)0)
+#ifdef __MBED__
+#	define UNREACHABLE()	MBED_UNREACHABLE
+#else
+#	define UNREACHABLE() __builtin_unreachable()
+#endif
+// no BREAKPOINT() - these must be removed in release builds
+
+#endif // debug
+
+
+
+// --------------------------------------------------------------------------------------------------------------------
+// Tracing
+//
+#ifdef DEBUG
+
+// Do not call these directly, use DTRC
+_extern_c void trc_dbg(const char *file, int line, const char *func, const char *fmt, ...) __attribute__((format(printf,4,5)));
+_extern_c void trc_vdbg(const char *file, int line, const char *func, const char *fmt, va_list ap);
+
+#define DTRC(_fmt, ...) trc_dbg(__FILE__, __LINE__, __func__, (_fmt), ## __VA_ARGS__)
+
+
+#else // DEBUG
+
+#define DTRC(_fmt, ...)	((void)0)
+
+#endif
+
+// Do not call these directly, use TRC_* macros
+_extern_c void trc_printf(const char *fmt, ...) __attribute__((format(printf,1,2)));
+_extern_c void trc_vprintf(const char *fmt, va_list ap);
+
+// These exists even in release builds
+#define TRC_INF(_fmt, ...) trc_printf((_fmt), ## __VA_ARGS__)
+#define TRC_WRN TRC_INF
+#define TRC_ERR TRC_INF
+#define TRC_VERR(fmt, ap) trc_vprintf((fmt), (ap))
+
+#endif // __ARCH_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/mbed-util.h	Fri Feb 15 10:48:30 2019 +0100
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2019 Helmut Tschemernjak
+ * 30826 Garbsen (Hannover) Germany
+ * Licensed under the Apache License, Version 2.0);
+ */
+
+
+#ifndef __MBED_UTIL_H__
+#define __MBED_UTIL_H__
+
+
+extern int CPUID(uint8_t *buf, int maxSize, uint32_t value);
+extern float BatteryVoltage(void);
+extern void OTPWrite(uint8_t *address, const void *d, size_t length);
+
+
+
+
+#endif // __MBED_UTIL_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/mbed-util.s	Fri Feb 15 10:48:30 2019 +0100
@@ -0,0 +1,1666 @@
+#ifdef __ARMCC_VERSION
+; generated by Component: ARM Compiler 5.06 update 4 (build 422) Tool: armcc [4d3604]
+; commandline armcc [--cpp --split_sections -c -S --gnu -oBUILD\NUCLEO_L432KC\ARM\mbed-util.o --depend=BUILD\NUCLEO_L432KC\ARM\mbed-util.d --cpu=Cortex-M4.fp --apcs=interwork -O3 -Otime --preinclude=.\BUILD\NUCLEO_L432KC\ARM\mbed_config.h -I. -I./BulkSerial -I./ESP -I./FATFileSystem -I./FATFileSystem/ChaN -I./Flash -I./Flash/MD5 -I./Hardware-STM -I./NVProperty -I./Power -I./RadioShuttleLib -I./RadioShuttleLib/examples -I./RadioShuttleLib/examples/PMSensorRadio -I./RadioShuttleLib/examples/RadioTest -I./RadioShuttleLib/util -I./STM_MEMS -I./SX1276GenericLib -I./SX1276GenericLib/radio -I./SX1276GenericLib/registers -I./SX1276GenericLib/sx1276 -I./USBDeviceHT -I./USBDeviceHT/USBDevice -I./USBDeviceHT/USBSerial -I./USBDeviceHT/USBSerialBuffered -I./USBDeviceHT/targets/TARGET_STM -I./WIZnetInterface -I./WIZnetInterface/Socket -I./WIZnetInterface/arch -I./WIZnetInterface/arch/ext -I./WIZnetInterface/arch/int -I./WakeUpRTC -I./WakeUpRTC/Device -I./WakeUpRTC/Device/LPC1114_WakeInterruptIn -I./ZModem -I./mbed -I./mbed/e95d10626187 -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4 -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/TARGET_NUCLEO_L432KC -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/device -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/device -I./mbed/e95d10626187/drivers -I./mbed/e95d10626187/hal -I./mbed/e95d10626187/platform -D__ASSERT_MSG -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x40000 -DDEVICE_CRC=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -D__FPU_PRESENT=1 -DDEVICE_PORTOUT=1 -DDEVICE_PORTINOUT=1 -DTARGET_RTOS_M4_M7 -DDEVICE_RTC=1 -DDEVICE_SERIAL_ASYNCH=1 -D__CMSIS_RTOS -DDEVICE_USTICKER=1 -DDEVICE_CAN=1 -DTARGET_CORTEX_M -DDEVICE_I2C_ASYNCH=1 -DTARGET_LIKE_CORTEX_M4 -DDEVICE_ANALOGOUT=1 -DTARGET_M4 -DARM_MATH_CM4 -DTARGET_STM32L4 -DDEVICE_SPI_ASYNCH=1 -DDEVICE_LPTICKER=1 -DDEVICE_PWMOUT=1 -DTARGET_STM32L432xC -DMBED_BUILD_TIMESTAMP=1548340964.1 -DTARGET_CORTEX -DDEVICE_I2C=1 -DTRANSACTION_QUEUE_SIZE_SPI=2 -D__CORTEX_M4 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_FAMILY_STM32 -DTARGET_FF_ARDUINO -DDEVICE_PORTIN=1 -DTARGET_RELEASE -DTARGET_STM -DTARGET_STM32L432KC -DDEVICE_SERIAL_FC=1 -DDEVICE_TRNG=1 -DTARGET_LIKE_MBED -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DDEVICE_SPI=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_FLASH=1 -DTARGET_NUCLEO_L432KC -DTOOLCHAIN_ARM -DTOOLCHAIN_ARM_STD --no_vla --multibyte_chars --brief_diagnostics --no_depend_system_headers --restrict --no_rtti .\mbed-util.cpp]
+        THUMB
+        REQUIRE8
+        PRESERVE8
+
+        AREA ||i._Z14BatteryVoltagev||, CODE, READONLY, ALIGN=3
+
+_Z14BatteryVoltagev PROC
+        PUSH     {r4-r7,lr}
+        LDR      r5,|L0.328|
+        VPUSH    {d8}
+        SUB      sp,sp,#0x84
+        LDR      r0,[r5,#0x4c]
+        ORR      r0,r0,#0x2000
+        STR      r0,[r5,#0x4c]
+        LDR      r0,[r5,#0x4c]
+        AND      r0,r0,#0x2000
+        STR      r0,[sp,#0x80]
+        LDR      r0,[r5,#0x88]
+        ORR      r0,r0,#0x30000000
+        STR      r0,[r5,#0x88]
+        LDR      r6,|L0.332|
+        MOV      r0,sp
+        STR      r6,[sp,#0]
+        BL       HAL_ADC_DeInit
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#1.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOVS     r4,#0
+        MOVS     r7,#4
+        STRD     r4,r7,[sp,#0x10]
+        STR      r4,[sp,#4]
+        STR      r4,[sp,#8]
+        STR      r4,[sp,#0xc]
+        MOVS     r0,#1
+        STR      r4,[sp,#0x18]
+        STRD     r4,r0,[sp,#0x1c]
+        STRD     r4,r0,[sp,#0x24]
+        STR      r4,[sp,#0x2c]
+        LSLS     r0,r0,#12
+        STR      r4,[sp,#0x30]
+        STRD     r4,r0,[sp,#0x34]
+        MOV      r0,sp
+        STR      r4,[sp,#0x3c]
+        BL       HAL_ADC_Init
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#2.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        LDR      r0,|L0.336|
+        STR      r0,[sp,#0x68]
+        MOVS     r0,#6
+        STR      r0,[sp,#0x6c]
+        MOVS     r0,#7
+        STR      r0,[sp,#0x70]
+        MOVS     r0,#0x7f
+        STR      r4,[sp,#0x7c]
+        STRD     r0,r7,[sp,#0x74]
+        ADD      r1,sp,#0x68
+        MOV      r0,sp
+        BL       HAL_ADC_ConfigChannel
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#3.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOVS     r1,#0x7f
+        MOV      r0,sp
+        BL       HAL_ADCEx_Calibration_Start
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#4.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOV      r0,sp
+        BL       HAL_ADC_Start
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#5.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOVS     r1,#0xa
+        MOV      r0,sp
+        BL       HAL_ADC_PollForConversion
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#6.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOV      r0,sp
+        BL       HAL_ADC_GetValue
+        LDR      r1,|L0.340|
+        UDIV     r0,r1,r0
+        BL       __aeabi_ui2d
+        VLDR     d1,|L0.344|
+        VMOV     r2,r3,d1
+        BL       __aeabi_ddiv
+        BL       __aeabi_d2f
+        VMOV     s16,r0
+        MOV      r0,sp
+        BL       ADC_Disable
+        MOV      r0,sp
+        BL       HAL_ADC_DeInit
+        LDR      r0,[r5,#0x88]
+        BIC      r0,r0,#0x30000000
+        STR      r0,[r5,#0x88]
+        LDR      r0,[r5,#0x4c]
+        BIC      r0,r0,#0x2000
+        STR      r0,[r5,#0x4c]
+        LDR      r0,[r6,#8]
+        BIC      r0,r0,#0x1800000
+        STR      r0,[r6,#8]
+        ADD      sp,sp,#0x84
+        VMOV.F32 s0,s16
+        VPOP     {d8}
+        POP      {r4-r7,pc}
+        ENDP
+
+        DCW      0x0000
+|L0.328|
+        DCD      0x40021000
+|L0.332|
+        DCD      0x50040000
+|L0.336|
+        DCD      0x80000001
+|L0.340|
+        DCD      0x004afb50
+|L0.344|
+        DCFD     0x408f400000000000 ; 1000
+
+        AREA ||i._Z5CPUIDPhij||, CODE, READONLY, ALIGN=2
+
+_Z5CPUIDPhij PROC
+        LDR      r3,|L1.48|
+        CMP      r1,#0x10
+        ITT      LT
+        MOVLT    r0,#0
+        BXLT     lr
+        EOR      r1,r3,r2
+        LDR      r2,[r1,#0]
+        STR      r2,[r0,#0]
+        LDR      r2,[r1,#4]
+        STR      r2,[r0,#4]
+        LDR      r1,[r1,#8]
+        STR      r1,[r0,#8]
+        LDR      r1,|L1.52|
+        LDR      r2,|L1.56|
+        LDRB     r1,[r1,#0]
+        LDRH     r2,[r2,#0]
+        AND      r1,r1,#0x1f
+        ORR      r1,r1,r2,LSL #16
+        STR      r1,[r0,#0xc]
+        MOVS     r0,#0x10
+        BX       lr
+        ENDP
+
+|L1.48|
+        DCD      0x4aaa20c5
+|L1.52|
+        DCD      0x1fff7500
+|L1.56|
+        DCD      0x1fff75e0
+
+        AREA ||i._Z8OTPWritePhPKvj||, CODE, READONLY, ALIGN=1
+
+_Z8OTPWritePhPKvj PROC
+        PUSH     {r4-r6,lr}
+        SUB      sp,sp,#8
+        MOV      r6,r2
+        MOV      r4,r1
+        MOV      r5,r0
+        BL       HAL_FLASH_Unlock
+        CBZ      r6,|L2.84|
+|L2.16|
+        LDRB     r0,[r4,#0]
+        STRB     r0,[sp,#0]
+        LDRB     r0,[r4,#1]
+        STRB     r0,[sp,#1]
+        LDRB     r0,[r4,#2]
+        STRB     r0,[sp,#2]
+        LDRB     r0,[r4,#3]
+        STRB     r0,[sp,#3]
+        LDRB     r0,[r4,#4]
+        STRB     r0,[sp,#4]
+        LDRB     r0,[r4,#5]
+        STRB     r0,[sp,#5]
+        LDRB     r0,[r4,#6]
+        STRB     r0,[sp,#6]
+        LDRB     r0,[r4,#7]
+        STRB     r0,[sp,#7]
+        LDRD     r2,r3,[sp,#0]
+        MOV      r1,r5
+        MOVS     r0,#0
+        BL       HAL_FLASH_Program
+        ADDS     r4,r4,#8
+        ADDS     r5,r5,#8
+        SUBS     r6,r6,#8
+        BNE      |L2.16|
+|L2.84|
+        ADD      sp,sp,#8
+        POP      {r4-r6,lr}
+        B.W      HAL_FLASH_Lock
+        ENDP
+
+
+        AREA ||.ARM.exidx||, LINKORDER=||i._Z5CPUIDPhij||, DATA, READONLY, SECTYPE={SHT_ARM_EXIDX}, ALIGN=2
+
+        DCD      0x00000000
+        RELOC 42, ||i._Z5CPUIDPhij||
+        DCD      0x00000001
+
+        AREA ||area_number.4||, LINKORDER=||i._Z14BatteryVoltagev||, DATA, READONLY, SECTYPE={SHT_ARM_EXIDX}, ALIGN=2
+
+        EXPORTAS ||area_number.4||, ||.ARM.exidx||
+        DCD      0x00000000
+        RELOC 42, ||i._Z14BatteryVoltagev||
+        DCD      0x00000001
+
+        AREA ||area_number.5||, LINKORDER=||i._Z8OTPWritePhPKvj||, DATA, READONLY, SECTYPE={SHT_ARM_EXIDX}, ALIGN=2
+
+        EXPORTAS ||area_number.5||, ||.ARM.exidx||
+        DCD      0x00000000
+        RELOC 42, ||i._Z8OTPWritePhPKvj||
+        DCD      0x00000001
+
+        AREA ||.arm_vfe_header||, DATA, READONLY, NOALLOC, ALIGN=2
+
+        DCD      0x00000000
+
+;*** Start embedded assembler ***
+
+#line 1 ".\\mbed-util.cpp"
+	AREA ||.rev16_text||, CODE
+	THUMB
+	EXPORT |__asm___13_mbed_util_cpp_f390ad65___Z7__REV16j|
+#line 468 "./mbed/e95d10626187/TARGET_NUCLEO_L432KC/cmsis_armcc.h"
+|__asm___13_mbed_util_cpp_f390ad65___Z7__REV16j| PROC
+#line 469
+
+ rev16 r0, r0
+ bx lr
+	ENDP
+	AREA ||.revsh_text||, CODE
+	THUMB
+	EXPORT |__asm___13_mbed_util_cpp_f390ad65___Z7__REVSHs|
+#line 483
+|__asm___13_mbed_util_cpp_f390ad65___Z7__REVSHs| PROC
+#line 484
+
+ revsh r0, r0
+ bx lr
+	ENDP
+	AREA ||.rrx_text||, CODE
+	THUMB
+	EXPORT |__asm___13_mbed_util_cpp_f390ad65___Z5__RRXj|
+#line 670
+|__asm___13_mbed_util_cpp_f390ad65___Z5__RRXj| PROC
+#line 671
+
+ rrx r0, r0
+ bx lr
+	ENDP
+
+;*** End   embedded assembler ***
+
+        EXPORT _Z14BatteryVoltagev [CODE]
+        EXPORT _Z5CPUIDPhij [CODE]
+        EXPORT _Z8OTPWritePhPKvj [CODE]
+
+        IMPORT ||Lib$$Request$$armlib|| [CODE,WEAK]
+        IMPORT ||Lib$$Request$$cpplib|| [CODE,WEAK]
+        IMPORT HAL_ADC_DeInit [CODE]
+        IMPORT HAL_ADC_Init [CODE]
+        IMPORT HAL_ADC_ConfigChannel [CODE]
+        IMPORT HAL_ADCEx_Calibration_Start [CODE]
+        IMPORT HAL_ADC_Start [CODE]
+        IMPORT HAL_ADC_PollForConversion [CODE]
+        IMPORT HAL_ADC_GetValue [CODE]
+        IMPORT __aeabi_ui2d [CODE]
+        IMPORT __aeabi_ddiv [CODE]
+        IMPORT __aeabi_d2f [CODE]
+        IMPORT ADC_Disable [CODE]
+        IMPORT HAL_FLASH_Unlock [CODE]
+        IMPORT HAL_FLASH_Program [CODE]
+        IMPORT HAL_FLASH_Lock [CODE]
+
+        ATTR FILESCOPE
+        ATTR SETVALUE Tag_ABI_PCS_wchar_t,2
+        ATTR SETVALUE Tag_ABI_enum_size,1
+        ATTR SETVALUE Tag_ABI_optimization_goals,2
+        ATTR SETSTRING Tag_conformance,"2.09"
+        ATTR SETVALUE AV,6,0
+        ATTR SETVALUE AV,18,1
+
+        ASSERT {ENDIAN} = "little"
+        ASSERT {INTER} = {TRUE}
+        ASSERT {ROPI} = {FALSE}
+        ASSERT {RWPI} = {FALSE}
+        ASSERT {IEEE_FULL} = {FALSE}
+        ASSERT {IEEE_PART} = {FALSE}
+        ASSERT {IEEE_JAVA} = {FALSE}
+        END
+#elif defined(__GNUC__)
+	.cpu cortex-m4
+	.eabi_attribute 27, 1
+	.eabi_attribute 20, 1
+	.eabi_attribute 21, 1
+	.eabi_attribute 23, 3
+	.eabi_attribute 24, 1
+	.eabi_attribute 25, 1
+	.eabi_attribute 26, 1
+	.eabi_attribute 30, 4
+	.eabi_attribute 34, 1
+	.eabi_attribute 18, 4
+	.file	"mbed-util.cpp"
+	.text
+.Ltext0:
+	.cfi_sections	.debug_frame
+	.section	.text._Z5CPUIDPhim,"ax",%progbits
+	.align	1
+	.global	_Z5CPUIDPhim
+	.arch armv7e-m
+	.syntax unified
+	.thumb
+	.thumb_func
+	.fpu fpv4-sp-d16
+	.type	_Z5CPUIDPhim, %function
+_Z5CPUIDPhim:
+.LFB2093:
+	.file 1 "./mbed-util.cpp"
+	.loc 1 22 1
+	.cfi_startproc
+	@ args = 0, pretend = 0, frame = 8
+	@ frame_needed = 0, uses_anonymous_args = 0
+.LBB2:
+	.loc 1 28 5
+	cmp	r1, #15
+.LBE2:
+	.loc 1 22 1
+	push	{r0, r1, r2, lr}
+	.cfi_def_cfa_offset 16
+	.cfi_offset 14, -4
+	.loc 1 22 1
+	mov	r3, r0
+.LBB5:
+	.loc 1 28 5
+	ble	.L4
+.LBB3:
+	.loc 1 30 21
+	ldr	r1, .L6
+	eors	r1, r1, r2
+	adds	r0, r0, #12
+	subs	r1, r1, r3
+.L3:
+.LBB4:
+	.loc 1 34 19 discriminator 2
+	ldrb	r2, [r3, r1]	@ zero_extendqisi2
+	.loc 1 34 17 discriminator 2
+	strb	r2, [r3], #1
+	.loc 1 33 27 discriminator 2
+	cmp	r0, r3
+	bne	.L3
+.LBE4:
+	.loc 1 36 19
+	ldr	r3, .L6+4
+	ldrh	r2, [r3]
+	.loc 1 36 64
+	subs	r3, r3, #224
+	.loc 1 36 101
+	ldrh	r3, [r3]
+	and	r3, r3, #31
+	.loc 1 36 60
+	orr	r3, r3, r2, lsl #16
+	.loc 1 37 9
+	movs	r2, #4
+	add	r1, sp, r2
+	.loc 1 36 12
+	str	r3, [sp, #4]
+	.loc 1 37 9
+	bl	memcpy
+	.loc 1 39 16
+	movs	r0, #16
+.L1:
+.LBE3:
+.LBE5:
+	.loc 1 42 1
+	add	sp, sp, #12
+	.cfi_remember_state
+	.cfi_def_cfa_offset 4
+	@ sp needed
+	ldr	pc, [sp], #4
+.L4:
+	.cfi_restore_state
+	.loc 1 41 12
+	movs	r0, #0
+	b	.L1
+.L7:
+	.align	2
+.L6:
+	.word	1252663493
+	.word	536835552
+	.cfi_endproc
+.LFE2093:
+	.size	_Z5CPUIDPhim, .-_Z5CPUIDPhim
+	.global	__aeabi_ui2d
+	.global	__aeabi_ddiv
+	.global	__aeabi_d2f
+	.section	.text._Z14BatteryVoltagev,"ax",%progbits
+	.align	1
+	.global	_Z14BatteryVoltagev
+	.syntax unified
+	.thumb
+	.thumb_func
+	.fpu fpv4-sp-d16
+	.type	_Z14BatteryVoltagev, %function
+_Z14BatteryVoltagev:
+.LFB2094:
+	.loc 1 48 1
+	.cfi_startproc
+	@ args = 0, pretend = 0, frame = 136
+	@ frame_needed = 0, uses_anonymous_args = 0
+	push	{r4, r5, r6, r7, lr}
+	.cfi_def_cfa_offset 20
+	.cfi_offset 4, -20
+	.cfi_offset 5, -16
+	.cfi_offset 6, -12
+	.cfi_offset 7, -8
+	.cfi_offset 14, -4
+.LBB6:
+	.loc 1 60 5
+	ldr	r4, .L16
+.LBE6:
+	.loc 1 66 24
+	ldr	r6, .L16+4
+.LBB7:
+	.loc 1 60 5
+	ldr	r3, [r4, #76]
+	orr	r3, r3, #8192
+	str	r3, [r4, #76]
+	ldr	r3, [r4, #76]
+.LBE7:
+	.loc 1 48 1
+	sub	sp, sp, #140
+	.cfi_def_cfa_offset 160
+.LBB8:
+	.loc 1 60 5
+	and	r3, r3, #8192
+	str	r3, [sp, #4]
+	ldr	r3, [sp, #4]
+.LBE8:
+	.loc 1 62 5
+	ldr	r3, [r4, #136]
+	orr	r3, r3, #805306368
+	str	r3, [r4, #136]
+	.loc 1 67 23
+	add	r0, sp, #32
+	.loc 1 66 24
+	str	r6, [sp, #32]
+	.loc 1 67 23
+	bl	HAL_ADC_DeInit
+	.loc 1 67 5
+	cmp	r0, #0
+	bne	.L10
+	.loc 1 77 42
+	movs	r3, #1
+	.loc 1 78 42
+	strd	r3, r0, [sp, #64]
+	.loc 1 80 42
+	strd	r3, r0, [sp, #72]
+	.loc 1 74 42
+	movs	r7, #4
+	.loc 1 83 42
+	mov	r3, #4096
+	.loc 1 71 42
+	strd	r0, r0, [sp, #36]
+	.loc 1 73 42
+	strd	r0, r0, [sp, #44]
+	.loc 1 75 42
+	strd	r7, r0, [sp, #52]
+	.loc 1 76 42
+	str	r0, [sp, #60]
+	.loc 1 82 42
+	strd	r0, r0, [sp, #80]
+	.loc 1 84 42
+	strd	r3, r0, [sp, #88]
+	.loc 1 86 21
+	add	r0, sp, #32
+	bl	HAL_ADC_Init
+	.loc 1 86 5
+	cmp	r0, #0
+	bne	.L11
+	.loc 1 92 26
+	ldr	r2, .L16+8
+	movs	r3, #6
+	strd	r2, r3, [sp, #8]
+	.loc 1 94 26
+	movs	r5, #127
+	movs	r3, #7
+	.loc 1 96 20
+	strd	r7, r0, [sp, #24]
+	.loc 1 98 30
+	add	r1, sp, #8
+	add	r0, sp, #32
+	.loc 1 94 26
+	strd	r3, r5, [sp, #16]
+	.loc 1 98 30
+	bl	HAL_ADC_ConfigChannel
+	.loc 1 98 5
+	cmp	r0, #0
+	bne	.L12
+	.loc 1 117 36
+	mov	r1, r5
+	add	r0, sp, #32
+	bl	HAL_ADCEx_Calibration_Start
+	.loc 1 117 5
+	cmp	r0, #0
+	bne	.L13
+	.loc 1 123 22
+	add	r0, sp, #32
+	bl	HAL_ADC_Start
+	.loc 1 123 5
+	cmp	r0, #0
+	bne	.L14
+	.loc 1 132 34
+	movs	r1, #10
+	add	r0, sp, #32
+	bl	HAL_ADC_PollForConversion
+	.loc 1 132 5
+	cmp	r0, #0
+	bne	.L15
+	.loc 1 141 38
+	add	r0, sp, #32
+	bl	HAL_ADC_GetValue
+	.loc 1 147 54
+	ldr	r3, .L16+12
+	udiv	r0, r3, r0
+	bl	__aeabi_ui2d
+	ldr	r3, .L16+16
+	movs	r2, #0
+	bl	__aeabi_ddiv
+	.loc 1 147 11
+	bl	__aeabi_d2f
+	mov	r5, r0	@ float
+	.loc 1 149 16
+	add	r0, sp, #32
+	bl	ADC_Disable
+	.loc 1 150 19
+	add	r0, sp, #32
+	bl	HAL_ADC_DeInit
+	.loc 1 159 5
+	ldr	r3, [r4, #136]
+	bic	r3, r3, #805306368
+	str	r3, [r4, #136]
+	.loc 1 160 5
+	ldr	r3, [r4, #76]
+	bic	r3, r3, #8192
+	str	r3, [r4, #76]
+	.loc 1 163 14
+	ldr	r3, [r6, #8]
+	bic	r3, r3, #25165824
+	str	r3, [r6, #8]
+.L8:
+	.loc 1 169 1
+	mov	r0, r5	@ float
+	add	sp, sp, #140
+	.cfi_remember_state
+	.cfi_def_cfa_offset 20
+	@ sp needed
+	pop	{r4, r5, r6, r7, pc}
+.L10:
+	.cfi_restore_state
+	.loc 1 68 16
+	mov	r5, #1065353216
+	b	.L8
+.L11:
+	.loc 1 87 16
+	mov	r5, #1073741824
+	b	.L8
+.L12:
+	.loc 1 99 16
+	ldr	r5, .L16+20
+	b	.L8
+.L13:
+	.loc 1 119 16
+	mov	r5, #1082130432
+	b	.L8
+.L14:
+	.loc 1 125 16
+	ldr	r5, .L16+24
+	b	.L8
+.L15:
+	.loc 1 134 16
+	ldr	r5, .L16+28
+	b	.L8
+.L17:
+	.align	2
+.L16:
+	.word	1073876992
+	.word	1342439424
+	.word	-2147483647
+	.word	4914000
+	.word	1083129856
+	.word	1077936128
+	.word	1084227584
+	.word	1086324736
+	.cfi_endproc
+.LFE2094:
+	.size	_Z14BatteryVoltagev, .-_Z14BatteryVoltagev
+	.section	.text._Z8OTPWritePhPKvj,"ax",%progbits
+	.align	1
+	.global	_Z8OTPWritePhPKvj
+	.syntax unified
+	.thumb
+	.thumb_func
+	.fpu fpv4-sp-d16
+	.type	_Z8OTPWritePhPKvj, %function
+_Z8OTPWritePhPKvj:
+.LFB2095:
+	.loc 1 174 1
+	.cfi_startproc
+	@ args = 0, pretend = 0, frame = 8
+	@ frame_needed = 0, uses_anonymous_args = 0
+	push	{r0, r1, r2, r4, r5, r6, r7, lr}
+	.cfi_def_cfa_offset 32
+	.cfi_offset 4, -20
+	.cfi_offset 5, -16
+	.cfi_offset 6, -12
+	.cfi_offset 7, -8
+	.cfi_offset 14, -4
+	.loc 1 174 1
+	mov	r5, r0
+	mov	r6, r1
+	mov	r7, r2
+	.loc 1 179 18
+	bl	HAL_FLASH_Unlock
+	movs	r4, #0
+.L21:
+	.loc 1 180 16
+	cmn	r7, r4
+	sub	r0, r6, r4
+	sub	r1, r5, r4
+	beq	.L19
+	movs	r3, #0
+.L20:
+.LBB9:
+.LBB10:
+	.loc 1 182 33 discriminator 2
+	ldrb	r2, [r0, r3]	@ zero_extendqisi2
+	strb	r2, [sp, r3]
+	adds	r3, r3, #1
+	.loc 1 181 25 discriminator 2
+	cmp	r3, #8
+	bne	.L20
+.LBE10:
+	.loc 1 184 23
+	ldrd	r2, [sp]
+	movs	r0, #0
+	bl	HAL_FLASH_Program
+	subs	r4, r4, #8
+.LBE9:
+	.loc 1 180 2
+	b	.L21
+.L19:
+	.loc 1 189 19
+	bl	HAL_FLASH_Lock
+	.loc 1 190 1
+	add	sp, sp, #12
+	.cfi_def_cfa_offset 20
+	@ sp needed
+	pop	{r4, r5, r6, r7, pc}
+	.cfi_endproc
+.LFE2095:
+	.size	_Z8OTPWritePhPKvj, .-_Z8OTPWritePhPKvj
+	.text
+.Letext0:
+	.section	.debug_info,"",%progbits
+.Ldebug_info0:
+	.4byte	0x64
+	.2byte	0x4
+	.4byte	.Ldebug_abbrev0
+	.byte	0x4
+	.uleb128 0x1
+	.4byte	.LASF6
+	.byte	0x4
+	.4byte	.LASF7
+	.4byte	.LASF8
+	.4byte	.Ldebug_ranges0+0
+	.4byte	0
+	.4byte	.Ldebug_line0
+	.uleb128 0x2
+	.4byte	.LASF0
+	.byte	0x1
+	.byte	0xad
+	.byte	0x6
+	.4byte	.LASF2
+	.4byte	.LFB2095
+	.4byte	.LFE2095-.LFB2095
+	.uleb128 0x1
+	.byte	0x9c
+	.uleb128 0x2
+	.4byte	.LASF1
+	.byte	0x1
+	.byte	0x2f
+	.byte	0x1
+	.4byte	.LASF3
+	.4byte	.LFB2094
+	.4byte	.LFE2094-.LFB2094
+	.uleb128 0x1
+	.byte	0x9c
+	.uleb128 0x2
+	.4byte	.LASF4
+	.byte	0x1
+	.byte	0x15
+	.byte	0x1
+	.4byte	.LASF5
+	.4byte	.LFB2093
+	.4byte	.LFE2093-.LFB2093
+	.uleb128 0x1
+	.byte	0x9c
+	.byte	0
+	.section	.debug_abbrev,"",%progbits
+.Ldebug_abbrev0:
+	.uleb128 0x1
+	.uleb128 0x11
+	.byte	0x1
+	.uleb128 0x25
+	.uleb128 0xe
+	.uleb128 0x13
+	.uleb128 0xb
+	.uleb128 0x3
+	.uleb128 0xe
+	.uleb128 0x1b
+	.uleb128 0xe
+	.uleb128 0x55
+	.uleb128 0x17
+	.uleb128 0x11
+	.uleb128 0x1
+	.uleb128 0x10
+	.uleb128 0x17
+	.byte	0
+	.byte	0
+	.uleb128 0x2
+	.uleb128 0x2e
+	.byte	0
+	.uleb128 0x3f
+	.uleb128 0x19
+	.uleb128 0x3
+	.uleb128 0xe
+	.uleb128 0x3a
+	.uleb128 0xb
+	.uleb128 0x3b
+	.uleb128 0xb
+	.uleb128 0x39
+	.uleb128 0xb
+	.uleb128 0x6e
+	.uleb128 0xe
+	.uleb128 0x11
+	.uleb128 0x1
+	.uleb128 0x12
+	.uleb128 0x6
+	.uleb128 0x40
+	.uleb128 0x18
+	.uleb128 0x2116
+	.uleb128 0x19
+	.byte	0
+	.byte	0
+	.byte	0
+	.section	.debug_aranges,"",%progbits
+	.4byte	0x2c
+	.2byte	0x2
+	.4byte	.Ldebug_info0
+	.byte	0x4
+	.byte	0
+	.2byte	0
+	.2byte	0
+	.4byte	.LFB2093
+	.4byte	.LFE2093-.LFB2093
+	.4byte	.LFB2094
+	.4byte	.LFE2094-.LFB2094
+	.4byte	.LFB2095
+	.4byte	.LFE2095-.LFB2095
+	.4byte	0
+	.4byte	0
+	.section	.debug_ranges,"",%progbits
+.Ldebug_ranges0:
+	.4byte	.LFB2093
+	.4byte	.LFE2093
+	.4byte	.LFB2094
+	.4byte	.LFE2094
+	.4byte	.LFB2095
+	.4byte	.LFE2095
+	.4byte	0
+	.4byte	0
+	.section	.debug_line,"",%progbits
+.Ldebug_line0:
+	.section	.debug_str,"MS",%progbits,1
+.LASF8:
+	.ascii	"/Volumes/Data/work/mbed-work/Turtle_RadioShuttle\000"
+.LASF7:
+	.ascii	"./mbed-util.cpp\000"
+.LASF0:
+	.ascii	"OTPWrite\000"
+.LASF5:
+	.ascii	"_Z5CPUIDPhim\000"
+.LASF4:
+	.ascii	"CPUID\000"
+.LASF3:
+	.ascii	"_Z14BatteryVoltagev\000"
+.LASF6:
+	.ascii	"GNU C++98 8.2.1 20181213 (release) [gcc-8-branch re"
+	.ascii	"vision 267074] -mcpu=cortex-m4 -mthumb -mfpu=fpv4-s"
+	.ascii	"p-d16 -mfloat-abi=softfp -march=armv7e-m+fp -g1 -Os"
+	.ascii	" -std=gnu++98 -fno-rtti -fmessage-length=0 -fno-exc"
+	.ascii	"eptions -fno-builtin -ffunction-sections -fdata-sec"
+	.ascii	"tions -funsigned-char -fno-delete-null-pointer-chec"
+	.ascii	"ks -fomit-frame-pointer\000"
+.LASF1:
+	.ascii	"BatteryVoltage\000"
+.LASF2:
+	.ascii	"_Z8OTPWritePhPKvj\000"
+	.ident	"GCC: (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.1 20181213 (release) [gcc-8-branch revision 267074]"
+#endif
+#ifdef __ARMCC_VERSION
+; generated by Component: ARM Compiler 5.06 update 4 (build 422) Tool: armcc [4d3604]
+; commandline armcc [--cpp --split_sections -c -S --gnu -oBUILD\NUCLEO_L432KC\ARM\mbed-util.o --depend=BUILD\NUCLEO_L432KC\ARM\mbed-util.d --cpu=Cortex-M4.fp --apcs=interwork -O3 -Otime --preinclude=.\BUILD\NUCLEO_L432KC\ARM\mbed_config.h -I. -I./BulkSerial -I./ESP -I./FATFileSystem -I./FATFileSystem/ChaN -I./Flash -I./Flash/MD5 -I./Hardware-STM -I./NVProperty -I./Power -I./RadioShuttleLib -I./RadioShuttleLib/examples -I./RadioShuttleLib/examples/PMSensorRadio -I./RadioShuttleLib/examples/RadioTest -I./RadioShuttleLib/util -I./STM_MEMS -I./SX1276GenericLib -I./SX1276GenericLib/radio -I./SX1276GenericLib/registers -I./SX1276GenericLib/sx1276 -I./USBDeviceHT -I./USBDeviceHT/USBDevice -I./USBDeviceHT/USBSerial -I./USBDeviceHT/USBSerialBuffered -I./USBDeviceHT/targets/TARGET_STM -I./WIZnetInterface -I./WIZnetInterface/Socket -I./WIZnetInterface/arch -I./WIZnetInterface/arch/ext -I./WIZnetInterface/arch/int -I./WakeUpRTC -I./WakeUpRTC/Device -I./WakeUpRTC/Device/LPC1114_WakeInterruptIn -I./ZModem -I./mbed -I./mbed/e95d10626187 -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4 -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/TARGET_NUCLEO_L432KC -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/device -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/device -I./mbed/e95d10626187/drivers -I./mbed/e95d10626187/hal -I./mbed/e95d10626187/platform -D__ASSERT_MSG -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x40000 -DDEVICE_CRC=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -D__FPU_PRESENT=1 -DDEVICE_PORTOUT=1 -DDEVICE_PORTINOUT=1 -DTARGET_RTOS_M4_M7 -DDEVICE_RTC=1 -DDEVICE_SERIAL_ASYNCH=1 -D__CMSIS_RTOS -DDEVICE_USTICKER=1 -DDEVICE_CAN=1 -DTARGET_CORTEX_M -DDEVICE_I2C_ASYNCH=1 -DTARGET_LIKE_CORTEX_M4 -DDEVICE_ANALOGOUT=1 -DTARGET_M4 -DARM_MATH_CM4 -DTARGET_STM32L4 -DDEVICE_SPI_ASYNCH=1 -DDEVICE_LPTICKER=1 -DDEVICE_PWMOUT=1 -DTARGET_STM32L432xC -DMBED_BUILD_TIMESTAMP=1548340964.1 -DTARGET_CORTEX -DDEVICE_I2C=1 -DTRANSACTION_QUEUE_SIZE_SPI=2 -D__CORTEX_M4 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_FAMILY_STM32 -DTARGET_FF_ARDUINO -DDEVICE_PORTIN=1 -DTARGET_RELEASE -DTARGET_STM -DTARGET_STM32L432KC -DDEVICE_SERIAL_FC=1 -DDEVICE_TRNG=1 -DTARGET_LIKE_MBED -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DDEVICE_SPI=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_FLASH=1 -DTARGET_NUCLEO_L432KC -DTOOLCHAIN_ARM -DTOOLCHAIN_ARM_STD --no_vla --multibyte_chars --brief_diagnostics --no_depend_system_headers --restrict --no_rtti .\mbed-util.cpp]
+        THUMB
+        REQUIRE8
+        PRESERVE8
+
+        AREA ||i._Z14BatteryVoltagev||, CODE, READONLY, ALIGN=3
+
+_Z14BatteryVoltagev PROC
+        PUSH     {r4-r7,lr}
+        LDR      r5,|L0.328|
+        VPUSH    {d8}
+        SUB      sp,sp,#0x84
+        LDR      r0,[r5,#0x4c]
+        ORR      r0,r0,#0x2000
+        STR      r0,[r5,#0x4c]
+        LDR      r0,[r5,#0x4c]
+        AND      r0,r0,#0x2000
+        STR      r0,[sp,#0x80]
+        LDR      r0,[r5,#0x88]
+        ORR      r0,r0,#0x30000000
+        STR      r0,[r5,#0x88]
+        LDR      r6,|L0.332|
+        MOV      r0,sp
+        STR      r6,[sp,#0]
+        BL       HAL_ADC_DeInit
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#1.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOVS     r4,#0
+        MOVS     r7,#4
+        STRD     r4,r7,[sp,#0x10]
+        STR      r4,[sp,#4]
+        STR      r4,[sp,#8]
+        STR      r4,[sp,#0xc]
+        MOVS     r0,#1
+        STR      r4,[sp,#0x18]
+        STRD     r4,r0,[sp,#0x1c]
+        STRD     r4,r0,[sp,#0x24]
+        STR      r4,[sp,#0x2c]
+        LSLS     r0,r0,#12
+        STR      r4,[sp,#0x30]
+        STRD     r4,r0,[sp,#0x34]
+        MOV      r0,sp
+        STR      r4,[sp,#0x3c]
+        BL       HAL_ADC_Init
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#2.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        LDR      r0,|L0.336|
+        STR      r0,[sp,#0x68]
+        MOVS     r0,#6
+        STR      r0,[sp,#0x6c]
+        MOVS     r0,#7
+        STR      r0,[sp,#0x70]
+        MOVS     r0,#0x7f
+        STR      r4,[sp,#0x7c]
+        STRD     r0,r7,[sp,#0x74]
+        ADD      r1,sp,#0x68
+        MOV      r0,sp
+        BL       HAL_ADC_ConfigChannel
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#3.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOVS     r1,#0x7f
+        MOV      r0,sp
+        BL       HAL_ADCEx_Calibration_Start
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#4.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOV      r0,sp
+        BL       HAL_ADC_Start
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#5.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOVS     r1,#0xa
+        MOV      r0,sp
+        BL       HAL_ADC_PollForConversion
+        CMP      r0,#0
+        ITTTT    NE
+        VMOVNE.F32 s0,#6.00000000
+        ADDNE    sp,sp,#0x84
+        VPOPNE   {d8}
+        POPNE    {r4-r7,pc}
+        MOV      r0,sp
+        BL       HAL_ADC_GetValue
+        LDR      r1,|L0.340|
+        UDIV     r0,r1,r0
+        BL       __aeabi_ui2d
+        VLDR     d1,|L0.344|
+        VMOV     r2,r3,d1
+        BL       __aeabi_ddiv
+        BL       __aeabi_d2f
+        VMOV     s16,r0
+        MOV      r0,sp
+        BL       ADC_Disable
+        MOV      r0,sp
+        BL       HAL_ADC_DeInit
+        LDR      r0,[r5,#0x88]
+        BIC      r0,r0,#0x30000000
+        STR      r0,[r5,#0x88]
+        LDR      r0,[r5,#0x4c]
+        BIC      r0,r0,#0x2000
+        STR      r0,[r5,#0x4c]
+        LDR      r0,[r6,#8]
+        BIC      r0,r0,#0x1800000
+        STR      r0,[r6,#8]
+        ADD      sp,sp,#0x84
+        VMOV.F32 s0,s16
+        VPOP     {d8}
+        POP      {r4-r7,pc}
+        ENDP
+
+        DCW      0x0000
+|L0.328|
+        DCD      0x40021000
+|L0.332|
+        DCD      0x50040000
+|L0.336|
+        DCD      0x80000001
+|L0.340|
+        DCD      0x004afb50
+|L0.344|
+        DCFD     0x408f400000000000 ; 1000
+
+        AREA ||i._Z5CPUIDPhij||, CODE, READONLY, ALIGN=2
+
+_Z5CPUIDPhij PROC
+        LDR      r3,|L1.48|
+        CMP      r1,#0x10
+        ITT      LT
+        MOVLT    r0,#0
+        BXLT     lr
+        EOR      r1,r3,r2
+        LDR      r2,[r1,#0]
+        STR      r2,[r0,#0]
+        LDR      r2,[r1,#4]
+        STR      r2,[r0,#4]
+        LDR      r1,[r1,#8]
+        STR      r1,[r0,#8]
+        LDR      r1,|L1.52|
+        LDR      r2,|L1.56|
+        LDRB     r1,[r1,#0]
+        LDRH     r2,[r2,#0]
+        AND      r1,r1,#0x1f
+        ORR      r1,r1,r2,LSL #16
+        STR      r1,[r0,#0xc]
+        MOVS     r0,#0x10
+        BX       lr
+        ENDP
+
+|L1.48|
+        DCD      0x4aaa20c5
+|L1.52|
+        DCD      0x1fff7500
+|L1.56|
+        DCD      0x1fff75e0
+
+        AREA ||i._Z8OTPWritePhPKvj||, CODE, READONLY, ALIGN=1
+
+_Z8OTPWritePhPKvj PROC
+        PUSH     {r4-r6,lr}
+        SUB      sp,sp,#8
+        MOV      r6,r2
+        MOV      r4,r1
+        MOV      r5,r0
+        BL       HAL_FLASH_Unlock
+        CBZ      r6,|L2.84|
+|L2.16|
+        LDRB     r0,[r4,#0]
+        STRB     r0,[sp,#0]
+        LDRB     r0,[r4,#1]
+        STRB     r0,[sp,#1]
+        LDRB     r0,[r4,#2]
+        STRB     r0,[sp,#2]
+        LDRB     r0,[r4,#3]
+        STRB     r0,[sp,#3]
+        LDRB     r0,[r4,#4]
+        STRB     r0,[sp,#4]
+        LDRB     r0,[r4,#5]
+        STRB     r0,[sp,#5]
+        LDRB     r0,[r4,#6]
+        STRB     r0,[sp,#6]
+        LDRB     r0,[r4,#7]
+        STRB     r0,[sp,#7]
+        LDRD     r2,r3,[sp,#0]
+        MOV      r1,r5
+        MOVS     r0,#0
+        BL       HAL_FLASH_Program
+        ADDS     r4,r4,#8
+        ADDS     r5,r5,#8
+        SUBS     r6,r6,#8
+        BNE      |L2.16|
+|L2.84|
+        ADD      sp,sp,#8
+        POP      {r4-r6,lr}
+        B.W      HAL_FLASH_Lock
+        ENDP
+
+
+        AREA ||.ARM.exidx||, LINKORDER=||i._Z5CPUIDPhij||, DATA, READONLY, SECTYPE={SHT_ARM_EXIDX}, ALIGN=2
+
+        DCD      0x00000000
+        RELOC 42, ||i._Z5CPUIDPhij||
+        DCD      0x00000001
+
+        AREA ||area_number.4||, LINKORDER=||i._Z14BatteryVoltagev||, DATA, READONLY, SECTYPE={SHT_ARM_EXIDX}, ALIGN=2
+
+        EXPORTAS ||area_number.4||, ||.ARM.exidx||
+        DCD      0x00000000
+        RELOC 42, ||i._Z14BatteryVoltagev||
+        DCD      0x00000001
+
+        AREA ||area_number.5||, LINKORDER=||i._Z8OTPWritePhPKvj||, DATA, READONLY, SECTYPE={SHT_ARM_EXIDX}, ALIGN=2
+
+        EXPORTAS ||area_number.5||, ||.ARM.exidx||
+        DCD      0x00000000
+        RELOC 42, ||i._Z8OTPWritePhPKvj||
+        DCD      0x00000001
+
+        AREA ||.arm_vfe_header||, DATA, READONLY, NOALLOC, ALIGN=2
+
+        DCD      0x00000000
+
+;*** Start embedded assembler ***
+
+#line 1 ".\\mbed-util.cpp"
+	AREA ||.rev16_text||, CODE
+	THUMB
+	EXPORT |__asm___13_mbed_util_cpp_f390ad65___Z7__REV16j|
+#line 468 "./mbed/e95d10626187/TARGET_NUCLEO_L432KC/cmsis_armcc.h"
+|__asm___13_mbed_util_cpp_f390ad65___Z7__REV16j| PROC
+#line 469
+
+ rev16 r0, r0
+ bx lr
+	ENDP
+	AREA ||.revsh_text||, CODE
+	THUMB
+	EXPORT |__asm___13_mbed_util_cpp_f390ad65___Z7__REVSHs|
+#line 483
+|__asm___13_mbed_util_cpp_f390ad65___Z7__REVSHs| PROC
+#line 484
+
+ revsh r0, r0
+ bx lr
+	ENDP
+	AREA ||.rrx_text||, CODE
+	THUMB
+	EXPORT |__asm___13_mbed_util_cpp_f390ad65___Z5__RRXj|
+#line 670
+|__asm___13_mbed_util_cpp_f390ad65___Z5__RRXj| PROC
+#line 671
+
+ rrx r0, r0
+ bx lr
+	ENDP
+
+;*** End   embedded assembler ***
+
+        EXPORT _Z14BatteryVoltagev [CODE]
+        EXPORT _Z5CPUIDPhij [CODE]
+        EXPORT _Z8OTPWritePhPKvj [CODE]
+
+        IMPORT ||Lib$$Request$$armlib|| [CODE,WEAK]
+        IMPORT ||Lib$$Request$$cpplib|| [CODE,WEAK]
+        IMPORT HAL_ADC_DeInit [CODE]
+        IMPORT HAL_ADC_Init [CODE]
+        IMPORT HAL_ADC_ConfigChannel [CODE]
+        IMPORT HAL_ADCEx_Calibration_Start [CODE]
+        IMPORT HAL_ADC_Start [CODE]
+        IMPORT HAL_ADC_PollForConversion [CODE]
+        IMPORT HAL_ADC_GetValue [CODE]
+        IMPORT __aeabi_ui2d [CODE]
+        IMPORT __aeabi_ddiv [CODE]
+        IMPORT __aeabi_d2f [CODE]
+        IMPORT ADC_Disable [CODE]
+        IMPORT HAL_FLASH_Unlock [CODE]
+        IMPORT HAL_FLASH_Program [CODE]
+        IMPORT HAL_FLASH_Lock [CODE]
+
+        ATTR FILESCOPE
+        ATTR SETVALUE Tag_ABI_PCS_wchar_t,2
+        ATTR SETVALUE Tag_ABI_enum_size,1
+        ATTR SETVALUE Tag_ABI_optimization_goals,2
+        ATTR SETSTRING Tag_conformance,"2.09"
+        ATTR SETVALUE AV,6,0
+        ATTR SETVALUE AV,18,1
+
+        ASSERT {ENDIAN} = "little"
+        ASSERT {INTER} = {TRUE}
+        ASSERT {ROPI} = {FALSE}
+        ASSERT {RWPI} = {FALSE}
+        ASSERT {IEEE_FULL} = {FALSE}
+        ASSERT {IEEE_PART} = {FALSE}
+        ASSERT {IEEE_JAVA} = {FALSE}
+        END
+#elif defined(__GNUC__)
+	.cpu cortex-m4
+	.eabi_attribute 27, 1
+	.eabi_attribute 20, 1
+	.eabi_attribute 21, 1
+	.eabi_attribute 23, 3
+	.eabi_attribute 24, 1
+	.eabi_attribute 25, 1
+	.eabi_attribute 26, 1
+	.eabi_attribute 30, 4
+	.eabi_attribute 34, 1
+	.eabi_attribute 18, 4
+	.file	"mbed-util.cpp"
+	.text
+.Ltext0:
+	.cfi_sections	.debug_frame
+	.section	.text._Z5CPUIDPhim,"ax",%progbits
+	.align	1
+	.global	_Z5CPUIDPhim
+	.arch armv7e-m
+	.syntax unified
+	.thumb
+	.thumb_func
+	.fpu fpv4-sp-d16
+	.type	_Z5CPUIDPhim, %function
+_Z5CPUIDPhim:
+.LFB2093:
+	.file 1 "./mbed-util.cpp"
+	.loc 1 22 1
+	.cfi_startproc
+	@ args = 0, pretend = 0, frame = 8
+	@ frame_needed = 0, uses_anonymous_args = 0
+.LBB2:
+	.loc 1 28 5
+	cmp	r1, #15
+.LBE2:
+	.loc 1 22 1
+	push	{r0, r1, r2, lr}
+	.cfi_def_cfa_offset 16
+	.cfi_offset 14, -4
+	.loc 1 22 1
+	mov	r3, r0
+.LBB5:
+	.loc 1 28 5
+	ble	.L4
+.LBB3:
+	.loc 1 30 21
+	ldr	r1, .L6
+	eors	r1, r1, r2
+	adds	r0, r0, #12
+	subs	r1, r1, r3
+.L3:
+.LBB4:
+	.loc 1 34 19 discriminator 2
+	ldrb	r2, [r3, r1]	@ zero_extendqisi2
+	.loc 1 34 17 discriminator 2
+	strb	r2, [r3], #1
+	.loc 1 33 27 discriminator 2
+	cmp	r0, r3
+	bne	.L3
+.LBE4:
+	.loc 1 36 19
+	ldr	r3, .L6+4
+	ldrh	r2, [r3]
+	.loc 1 36 64
+	subs	r3, r3, #224
+	.loc 1 36 101
+	ldrh	r3, [r3]
+	and	r3, r3, #31
+	.loc 1 36 60
+	orr	r3, r3, r2, lsl #16
+	.loc 1 37 9
+	movs	r2, #4
+	add	r1, sp, r2
+	.loc 1 36 12
+	str	r3, [sp, #4]
+	.loc 1 37 9
+	bl	memcpy
+	.loc 1 39 16
+	movs	r0, #16
+.L1:
+.LBE3:
+.LBE5:
+	.loc 1 42 1
+	add	sp, sp, #12
+	.cfi_remember_state
+	.cfi_def_cfa_offset 4
+	@ sp needed
+	ldr	pc, [sp], #4
+.L4:
+	.cfi_restore_state
+	.loc 1 41 12
+	movs	r0, #0
+	b	.L1
+.L7:
+	.align	2
+.L6:
+	.word	1252663493
+	.word	536835552
+	.cfi_endproc
+.LFE2093:
+	.size	_Z5CPUIDPhim, .-_Z5CPUIDPhim
+	.global	__aeabi_ui2d
+	.global	__aeabi_ddiv
+	.global	__aeabi_d2f
+	.section	.text._Z14BatteryVoltagev,"ax",%progbits
+	.align	1
+	.global	_Z14BatteryVoltagev
+	.syntax unified
+	.thumb
+	.thumb_func
+	.fpu fpv4-sp-d16
+	.type	_Z14BatteryVoltagev, %function
+_Z14BatteryVoltagev:
+.LFB2094:
+	.loc 1 48 1
+	.cfi_startproc
+	@ args = 0, pretend = 0, frame = 136
+	@ frame_needed = 0, uses_anonymous_args = 0
+	push	{r4, r5, r6, r7, lr}
+	.cfi_def_cfa_offset 20
+	.cfi_offset 4, -20
+	.cfi_offset 5, -16
+	.cfi_offset 6, -12
+	.cfi_offset 7, -8
+	.cfi_offset 14, -4
+.LBB6:
+	.loc 1 60 5
+	ldr	r4, .L16
+.LBE6:
+	.loc 1 66 24
+	ldr	r6, .L16+4
+.LBB7:
+	.loc 1 60 5
+	ldr	r3, [r4, #76]
+	orr	r3, r3, #8192
+	str	r3, [r4, #76]
+	ldr	r3, [r4, #76]
+.LBE7:
+	.loc 1 48 1
+	sub	sp, sp, #140
+	.cfi_def_cfa_offset 160
+.LBB8:
+	.loc 1 60 5
+	and	r3, r3, #8192
+	str	r3, [sp, #4]
+	ldr	r3, [sp, #4]
+.LBE8:
+	.loc 1 62 5
+	ldr	r3, [r4, #136]
+	orr	r3, r3, #805306368
+	str	r3, [r4, #136]
+	.loc 1 67 23
+	add	r0, sp, #32
+	.loc 1 66 24
+	str	r6, [sp, #32]
+	.loc 1 67 23
+	bl	HAL_ADC_DeInit
+	.loc 1 67 5
+	cmp	r0, #0
+	bne	.L10
+	.loc 1 77 42
+	movs	r3, #1
+	.loc 1 78 42
+	strd	r3, r0, [sp, #64]
+	.loc 1 80 42
+	strd	r3, r0, [sp, #72]
+	.loc 1 74 42
+	movs	r7, #4
+	.loc 1 83 42
+	mov	r3, #4096
+	.loc 1 71 42
+	strd	r0, r0, [sp, #36]
+	.loc 1 73 42
+	strd	r0, r0, [sp, #44]
+	.loc 1 75 42
+	strd	r7, r0, [sp, #52]
+	.loc 1 76 42
+	str	r0, [sp, #60]
+	.loc 1 82 42
+	strd	r0, r0, [sp, #80]
+	.loc 1 84 42
+	strd	r3, r0, [sp, #88]
+	.loc 1 86 21
+	add	r0, sp, #32
+	bl	HAL_ADC_Init
+	.loc 1 86 5
+	cmp	r0, #0
+	bne	.L11
+	.loc 1 92 26
+	ldr	r2, .L16+8
+	movs	r3, #6
+	strd	r2, r3, [sp, #8]
+	.loc 1 94 26
+	movs	r5, #127
+	movs	r3, #7
+	.loc 1 96 20
+	strd	r7, r0, [sp, #24]
+	.loc 1 98 30
+	add	r1, sp, #8
+	add	r0, sp, #32
+	.loc 1 94 26
+	strd	r3, r5, [sp, #16]
+	.loc 1 98 30
+	bl	HAL_ADC_ConfigChannel
+	.loc 1 98 5
+	cmp	r0, #0
+	bne	.L12
+	.loc 1 117 36
+	mov	r1, r5
+	add	r0, sp, #32
+	bl	HAL_ADCEx_Calibration_Start
+	.loc 1 117 5
+	cmp	r0, #0
+	bne	.L13
+	.loc 1 123 22
+	add	r0, sp, #32
+	bl	HAL_ADC_Start
+	.loc 1 123 5
+	cmp	r0, #0
+	bne	.L14
+	.loc 1 132 34
+	movs	r1, #10
+	add	r0, sp, #32
+	bl	HAL_ADC_PollForConversion
+	.loc 1 132 5
+	cmp	r0, #0
+	bne	.L15
+	.loc 1 141 38
+	add	r0, sp, #32
+	bl	HAL_ADC_GetValue
+	.loc 1 147 54
+	ldr	r3, .L16+12
+	udiv	r0, r3, r0
+	bl	__aeabi_ui2d
+	ldr	r3, .L16+16
+	movs	r2, #0
+	bl	__aeabi_ddiv
+	.loc 1 147 11
+	bl	__aeabi_d2f
+	mov	r5, r0	@ float
+	.loc 1 149 16
+	add	r0, sp, #32
+	bl	ADC_Disable
+	.loc 1 150 19
+	add	r0, sp, #32
+	bl	HAL_ADC_DeInit
+	.loc 1 159 5
+	ldr	r3, [r4, #136]
+	bic	r3, r3, #805306368
+	str	r3, [r4, #136]
+	.loc 1 160 5
+	ldr	r3, [r4, #76]
+	bic	r3, r3, #8192
+	str	r3, [r4, #76]
+	.loc 1 163 14
+	ldr	r3, [r6, #8]
+	bic	r3, r3, #25165824
+	str	r3, [r6, #8]
+.L8:
+	.loc 1 169 1
+	mov	r0, r5	@ float
+	add	sp, sp, #140
+	.cfi_remember_state
+	.cfi_def_cfa_offset 20
+	@ sp needed
+	pop	{r4, r5, r6, r7, pc}
+.L10:
+	.cfi_restore_state
+	.loc 1 68 16
+	mov	r5, #1065353216
+	b	.L8
+.L11:
+	.loc 1 87 16
+	mov	r5, #1073741824
+	b	.L8
+.L12:
+	.loc 1 99 16
+	ldr	r5, .L16+20
+	b	.L8
+.L13:
+	.loc 1 119 16
+	mov	r5, #1082130432
+	b	.L8
+.L14:
+	.loc 1 125 16
+	ldr	r5, .L16+24
+	b	.L8
+.L15:
+	.loc 1 134 16
+	ldr	r5, .L16+28
+	b	.L8
+.L17:
+	.align	2
+.L16:
+	.word	1073876992
+	.word	1342439424
+	.word	-2147483647
+	.word	4914000
+	.word	1083129856
+	.word	1077936128
+	.word	1084227584
+	.word	1086324736
+	.cfi_endproc
+.LFE2094:
+	.size	_Z14BatteryVoltagev, .-_Z14BatteryVoltagev
+	.section	.text._Z8OTPWritePhPKvj,"ax",%progbits
+	.align	1
+	.global	_Z8OTPWritePhPKvj
+	.syntax unified
+	.thumb
+	.thumb_func
+	.fpu fpv4-sp-d16
+	.type	_Z8OTPWritePhPKvj, %function
+_Z8OTPWritePhPKvj:
+.LFB2095:
+	.loc 1 174 1
+	.cfi_startproc
+	@ args = 0, pretend = 0, frame = 8
+	@ frame_needed = 0, uses_anonymous_args = 0
+	push	{r0, r1, r2, r4, r5, r6, r7, lr}
+	.cfi_def_cfa_offset 32
+	.cfi_offset 4, -20
+	.cfi_offset 5, -16
+	.cfi_offset 6, -12
+	.cfi_offset 7, -8
+	.cfi_offset 14, -4
+	.loc 1 174 1
+	mov	r5, r0
+	mov	r6, r1
+	mov	r7, r2
+	.loc 1 179 18
+	bl	HAL_FLASH_Unlock
+	movs	r4, #0
+.L21:
+	.loc 1 180 16
+	cmn	r7, r4
+	sub	r0, r6, r4
+	sub	r1, r5, r4
+	beq	.L19
+	movs	r3, #0
+.L20:
+.LBB9:
+.LBB10:
+	.loc 1 182 33 discriminator 2
+	ldrb	r2, [r0, r3]	@ zero_extendqisi2
+	strb	r2, [sp, r3]
+	adds	r3, r3, #1
+	.loc 1 181 25 discriminator 2
+	cmp	r3, #8
+	bne	.L20
+.LBE10:
+	.loc 1 184 23
+	ldrd	r2, [sp]
+	movs	r0, #0
+	bl	HAL_FLASH_Program
+	subs	r4, r4, #8
+.LBE9:
+	.loc 1 180 2
+	b	.L21
+.L19:
+	.loc 1 189 19
+	bl	HAL_FLASH_Lock
+	.loc 1 190 1
+	add	sp, sp, #12
+	.cfi_def_cfa_offset 20
+	@ sp needed
+	pop	{r4, r5, r6, r7, pc}
+	.cfi_endproc
+.LFE2095:
+	.size	_Z8OTPWritePhPKvj, .-_Z8OTPWritePhPKvj
+	.text
+.Letext0:
+	.section	.debug_info,"",%progbits
+.Ldebug_info0:
+	.4byte	0x64
+	.2byte	0x4
+	.4byte	.Ldebug_abbrev0
+	.byte	0x4
+	.uleb128 0x1
+	.4byte	.LASF6
+	.byte	0x4
+	.4byte	.LASF7
+	.4byte	.LASF8
+	.4byte	.Ldebug_ranges0+0
+	.4byte	0
+	.4byte	.Ldebug_line0
+	.uleb128 0x2
+	.4byte	.LASF0
+	.byte	0x1
+	.byte	0xad
+	.byte	0x6
+	.4byte	.LASF2
+	.4byte	.LFB2095
+	.4byte	.LFE2095-.LFB2095
+	.uleb128 0x1
+	.byte	0x9c
+	.uleb128 0x2
+	.4byte	.LASF1
+	.byte	0x1
+	.byte	0x2f
+	.byte	0x1
+	.4byte	.LASF3
+	.4byte	.LFB2094
+	.4byte	.LFE2094-.LFB2094
+	.uleb128 0x1
+	.byte	0x9c
+	.uleb128 0x2
+	.4byte	.LASF4
+	.byte	0x1
+	.byte	0x15
+	.byte	0x1
+	.4byte	.LASF5
+	.4byte	.LFB2093
+	.4byte	.LFE2093-.LFB2093
+	.uleb128 0x1
+	.byte	0x9c
+	.byte	0
+	.section	.debug_abbrev,"",%progbits
+.Ldebug_abbrev0:
+	.uleb128 0x1
+	.uleb128 0x11
+	.byte	0x1
+	.uleb128 0x25
+	.uleb128 0xe
+	.uleb128 0x13
+	.uleb128 0xb
+	.uleb128 0x3
+	.uleb128 0xe
+	.uleb128 0x1b
+	.uleb128 0xe
+	.uleb128 0x55
+	.uleb128 0x17
+	.uleb128 0x11
+	.uleb128 0x1
+	.uleb128 0x10
+	.uleb128 0x17
+	.byte	0
+	.byte	0
+	.uleb128 0x2
+	.uleb128 0x2e
+	.byte	0
+	.uleb128 0x3f
+	.uleb128 0x19
+	.uleb128 0x3
+	.uleb128 0xe
+	.uleb128 0x3a
+	.uleb128 0xb
+	.uleb128 0x3b
+	.uleb128 0xb
+	.uleb128 0x39
+	.uleb128 0xb
+	.uleb128 0x6e
+	.uleb128 0xe
+	.uleb128 0x11
+	.uleb128 0x1
+	.uleb128 0x12
+	.uleb128 0x6
+	.uleb128 0x40
+	.uleb128 0x18
+	.uleb128 0x2116
+	.uleb128 0x19
+	.byte	0
+	.byte	0
+	.byte	0
+	.section	.debug_aranges,"",%progbits
+	.4byte	0x2c
+	.2byte	0x2
+	.4byte	.Ldebug_info0
+	.byte	0x4
+	.byte	0
+	.2byte	0
+	.2byte	0
+	.4byte	.LFB2093
+	.4byte	.LFE2093-.LFB2093
+	.4byte	.LFB2094
+	.4byte	.LFE2094-.LFB2094
+	.4byte	.LFB2095
+	.4byte	.LFE2095-.LFB2095
+	.4byte	0
+	.4byte	0
+	.section	.debug_ranges,"",%progbits
+.Ldebug_ranges0:
+	.4byte	.LFB2093
+	.4byte	.LFE2093
+	.4byte	.LFB2094
+	.4byte	.LFE2094
+	.4byte	.LFB2095
+	.4byte	.LFE2095
+	.4byte	0
+	.4byte	0
+	.section	.debug_line,"",%progbits
+.Ldebug_line0:
+	.section	.debug_str,"MS",%progbits,1
+.LASF8:
+	.ascii	"/Volumes/Data/work/mbed-work/Turtle_RadioShuttle\000"
+.LASF7:
+	.ascii	"./mbed-util.cpp\000"
+.LASF0:
+	.ascii	"OTPWrite\000"
+.LASF5:
+	.ascii	"_Z5CPUIDPhim\000"
+.LASF4:
+	.ascii	"CPUID\000"
+.LASF3:
+	.ascii	"_Z14BatteryVoltagev\000"
+.LASF6:
+	.ascii	"GNU C++98 8.2.1 20181213 (release) [gcc-8-branch re"
+	.ascii	"vision 267074] -mcpu=cortex-m4 -mthumb -mfpu=fpv4-s"
+	.ascii	"p-d16 -mfloat-abi=softfp -march=armv7e-m+fp -g1 -Os"
+	.ascii	" -std=gnu++98 -fno-rtti -fmessage-length=0 -fno-exc"
+	.ascii	"eptions -fno-builtin -ffunction-sections -fdata-sec"
+	.ascii	"tions -funsigned-char -fno-delete-null-pointer-chec"
+	.ascii	"ks -fomit-frame-pointer\000"
+.LASF1:
+	.ascii	"BatteryVoltage\000"
+.LASF2:
+	.ascii	"_Z8OTPWritePhPKvj\000"
+	.ident	"GCC: (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.1 20181213 (release) [gcc-8-branch revision 267074]"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/utils.cpp	Fri Feb 15 10:48:30 2019 +0100
@@ -0,0 +1,516 @@
+/*
+ * Copyright (c) 2019 Helmut Tschemernjak
+ * 30826 Garbsen (Hannover) Germany
+ */
+#include "main.h"
+#include "GenericPingPong.h"
+#include "RadioTest.h"
+#ifdef TOOLCHAIN_GCC
+#include <malloc.h>
+#endif
+
+volatile uint32_t PendingInterrupts;	// global interrupt mask of received interrupts
+
+time_t cvt_date(char const *date, char const *time);
+
+static float GetBrownOutVolt(void);
+
+BufferedSerial *ser;
+#ifdef FEATURE_USBSERIAL
+USBSerialBuffered *usb;
+#endif
+bool _useDprintf;
+
+void InitSerial(int timeout, DigitalOut *led)
+{
+    _useDprintf = true;
+    bool uartActive = true;
+	
+#ifdef FEATURE_USBSERIAL
+	DigitalOut rx(USBRX);  // need to turn rx low to avoid floating signal
+    rx = 0;
+	DigitalIn uartRX(USBRX);
+	uartActive = uartRX.read();
+    if (!uartActive) {
+        usb = new USBSerialBuffered();
+        Timer t;
+        t.start();
+        while(!usb->connected()) {
+            if (led)
+                *led = !*led;
+            wait_ms(100);
+            if (timeout) {
+                if (t.read_ms() >= timeout) {
+					delete usb;
+					usb = NULL;
+					DigitalOut rx(USBRX);
+					rx = 0; // need to turn tx low to avoid floating signal
+					break;
+				}
+			}
+		}
+	}
+#endif
+	if (uartActive) {
+        ser = new BufferedSerial(USBTX, USBRX);
+        ser->baud(230400);
+        ser->format(8);
+    }
+
+    time_t t = cvt_date(__DATE__, __TIME__);
+    if (t > time(NULL)) {
+        set_time(t);
+    }
+}
+
+void RunStartup(void)
+{
+	rprintf("\r\n");
+    int mbedversion = 9999;
+#ifdef MBED_LIBRARY_VERSION // not available in mbed head compiles
+    mbedversion = MBED_LIBRARY_VERSION;
+#endif
+    dprintf("Turtle: %d.%d (%s %s mbed: v%d)", MAJOR_VERSION, MINOR_VERSION, __DATE__, __TIME__, mbedversion);
+
+    dprintf("SysClock: %u Hz.", (unsigned int)SystemCoreClock);
+#ifdef __ARMCC_VERSION
+    dprintf("ARM Compiler Version: 0x%x", __ARMCC_VERSION);
+#elif __GNUC__
+    dprintf("GCC Compiler Version: %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
+#endif
+	
+	const char *errstr;
+	if (__HAL_RCC_GET_FLAG(RCC_FLAG_BORRST) != RESET)
+		errstr = "RESET OCCURRED";
+	else
+	 	errstr = "initalized";
+	
+    dprintf("Brown Out Reset %s (%1.1f V)", errstr, GetBrownOutVolt());
+    dprintf("Voltage: %.2f (%s powered)", BatteryVoltage(), BatterySource());
+
+	dprintf("InitDefaults Done");
+	MemoryAvailable(true);
+	
+    __HAL_RCC_CLEAR_RESET_FLAGS();
+}
+void printTimeStamp()
+{
+    static LowPowerTimer *timer;
+    if (!timer) {
+        timer = new LowPowerTimer();
+        timer->start();
+    }
+    time_t seconds = time(NULL);
+    struct tm *tm = localtime(&seconds);
+    int usecs = timer->read_us();
+    if (usecs < 0) {
+        usecs = 0;
+        timer->stop();
+        timer->reset();
+        timer->start();
+    }
+    int msecs = usecs % 1000000;
+    
+    rprintf("%02d:%02d:%02d.%06d ", tm->tm_hour, tm->tm_min, tm->tm_sec, msecs);
+}
+
+void dprintf(const char *format, ...)
+{
+    std::va_list arg;
+
+    va_start(arg, format);
+    VAprintf(true, true, _useDprintf, format, arg);
+    va_end(arg);
+}
+
+void rprintf(const char *format, ...)
+{
+    std::va_list arg;
+
+    va_start(arg, format);
+    VAprintf(false, false, _useDprintf, format, arg);
+    va_end(arg);   
+}
+
+void VAprintf(bool timstamp, bool newline, bool printEnabled, const char *format, va_list arg)
+{
+     if (!printEnabled)
+        return;
+
+    if (timstamp)
+        printTimeStamp();
+#ifdef FEATURE_USBSERIAL
+    if (usb) {
+        usb->vprintf_irqsafe(format, arg);
+        if (newline)
+            usb->printf_irqsafe("\r\n");
+	}
+#endif
+    if (ser) {
+        // serial jas 
+        int r = 0;
+        r = vsnprintf(NULL, 0, format, arg);
+        if (r < 82) {
+            char buffer[82+1];
+
+            vsnprintf(buffer, sizeof(buffer), format, arg);
+            r = ser->write(buffer, r);
+        } else {
+            char *buffer = new char[r+1];
+            if (buffer) {
+                vsnprintf(buffer, r+1, format, arg);
+                r = ser->write(buffer, r);
+                delete[] buffer;
+            } else {
+                error("%s %d cannot alloc memory (%d bytes)!\r\n", __FILE__, __LINE__, r+1);
+                r = 0;
+            }
+        }
+        if (newline)
+            ser->write("\r\n", 2);
+    }
+}
+
+char *ConsoleReadline(char *buf, int buflen, bool echo, int timeout_ms)
+{
+	int count = 0;
+	memset(buf, 0, buflen);
+	
+#ifdef FEATURE_USBSERIAL
+	if (usb == NULL && ser == NULL)
+		return NULL;
+#else
+	if (ser == NULL)
+		return NULL;
+#endif
+	
+	Timer t;
+	int start = 0;
+	if (timeout_ms) {
+		t.start();
+		start = t.read_ms();
+	}
+	
+#ifdef FEATURE_USBSERIAL
+	if (usb) {
+		usb->flush();
+		while(usb->readable())
+			usb->getc(); // flush old chars
+	}
+#endif
+	if (ser) {
+		while(ser->readable())
+			ser->getc(); // flush old chars
+	}
+		
+	while(true) {
+		if (timeout_ms && t.read_ms() - start > timeout_ms)
+			return NULL;
+		int c = -2;
+#ifdef FEATURE_USBSERIAL
+		if (usb && usb->readable())
+			c = usb->getc();
+#endif
+		if (ser && ser->readable())
+			c = ser->getc();
+		if (c == -2)
+			continue;
+		
+		if (c == 0 || c == -1  || c == '\r' || c == '\n' ||	c == 3 || c == 4)
+			break;
+		if (c == '\b' || c == 0x7f) { // backspace
+			if (count < 1)
+				continue;
+			buf[--count] = 0;
+			if (echo)
+				rprintf("\b \b");
+#ifdef FEATURE_USBSERIAL
+			if (usb)
+				usb->flush();
+#endif
+			continue;
+		}
+		if (echo) {
+			rprintf("%c", c);
+#ifdef FEATURE_USBSERIAL
+			if (usb)
+				usb->flush();
+#endif
+		}
+		
+		start = t.read_ms();
+		buf[count] = c;
+		if (count++ >= buflen-2)
+			break;
+		// dprintf("Got char: '%c'(%d)", c, c);
+	}
+	
+	if (echo)
+		rprintf("\r\n");
+	if (count)
+		return buf;
+	return NULL;
+}
+
+
+void dump(const char *title, void *data, int len)
+{
+	dump(title, data,  len, false);
+}
+
+void dump(const char *title, const void *data, int len, bool dwords)
+{
+    dprintf("dump(\"%s\", 0x%x, %d bytes)", title, (unsigned int)data, len);
+
+    int i, j, cnt;
+    unsigned char *u;
+    const int width = 16;
+    const int seppos = 7;
+
+    cnt = 0;
+    u = (unsigned char *)data;
+    while (len > 0) {
+        rprintf("%08x: ", (unsigned int)data + cnt);
+        if (dwords) {
+            unsigned int *ip = ( unsigned int *)u;
+            rprintf(" 0x%08x\r\n", *ip);
+            u+= 4;
+            len -= 4;
+            cnt += 4;
+            continue;
+        }
+        cnt += width;
+        j = len < width ? len : width;
+        for (i = 0; i < j; i++) {
+            rprintf("%2.2x ", *(u + i));
+            if (i == seppos)
+                rprintf(" ");
+        }
+        rprintf(" ");
+        if (j < width) {
+            i = width - j;
+            if (i > seppos + 1)
+                rprintf(" ");
+            while (i--) {
+                rprintf("%s", "   ");
+            }
+        }
+        for (i = 0; i < j; i++) {
+            int c = *(u + i);
+            if (c >= ' ' && c <= '~')
+                rprintf("%c", c);
+            else
+                rprintf(".");
+            if (i == seppos)
+                rprintf(" ");
+        }
+        len -= width;
+        u += width;
+        rprintf("\r\n");
+		if (ser)
+			wait_ms(5); // give the serial some time.
+    }
+    rprintf("--\r\n");
+}
+
+/*
+ * Convert compile time to system time
+ */
+time_t
+cvt_date(char const *date, char const *time)
+{
+    char s_month[5];
+    int year;
+    struct tm t;
+    static const char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
+    sscanf(date, "%s %d %d", s_month, &t.tm_mday, &year);
+    sscanf(time, "%2d %*c %2d %*c %2d", &t.tm_hour, &t.tm_min, &t.tm_sec);
+    // Find where is s_month in month_names. Deduce month value.
+    t.tm_mon = (strstr(month_names, s_month) - month_names) / 3;
+    t.tm_year = year - 1900;
+    return (int)mktime(&t);
+}
+
+
+
+void InterrruptMSG(enum InterrruptDevice irqid) {
+        help_atomic_or_relaxed(&PendingInterrupts, irqid);
+}
+
+
+uint32_t readclrPendingInterrupts() {
+	return help_atomic_readclr_relaxed(&PendingInterrupts);
+}
+
+uint32_t readPendingInterrupts() {
+	return help_atomic_load_relaxed(&PendingInterrupts);
+}
+
+const char *
+BatterySource(void)
+{
+    const char *pwrSource = "Battery";
+#ifdef BATPOWER_EN
+    {
+        DigitalIn pwr(BATPOWER_EN);
+        if (pwr == BATPOWER_EXT)
+            pwrSource = "USB";
+    }
+#endif
+	return pwrSource;
+}
+
+
+float
+GetBrownOutVolt(void)
+{
+		unsigned int *FlashOptionRegister = (unsigned int *)0x1FFF7800;
+		
+		int val = *FlashOptionRegister >> 8 & 0x7; // masking out the BOR bits 9-11
+		switch(val) {
+			case 0:
+				return 1.7;
+			case 1:
+				return 2.0;
+			case 2:
+				return 2.2;
+			case 3:
+				return 2.5;
+			case 4:
+				return 2.8;
+			default:
+				return 999;
+		}
+}
+
+void MCUReset(void)
+{
+    #define AIRCR_VECTKEY_MASK    0x05FA0000
+    SCB->AIRCR = AIRCR_VECTKEY_MASK | 0x04; // NVIC_GenerateSystemReset();
+}
+
+
+#define FREEMEM_CELL    100
+
+struct elem { /* Definition of a structure that is FREEMEM_CELL bytes  in size.) */
+    struct elem *next;
+    char dummy[FREEMEM_CELL-2];
+};
+
+size_t
+MemoryAvailable(bool print)
+{
+    size_t counter;
+#ifdef TOOLCHAIN_GCC
+    struct mallinfo mi = mallinfo();
+    extern char end[];
+    extern char _estack[];
+    counter = (_estack - end) - mi.uordblks;
+    if (print)
+        dprintf("MemoryAvailable: %d kB (%d bytes)", counter/1024, counter);
+    return counter;
+#else
+    struct elem *head, *current, *nextone;
+    current = head = (struct elem*) malloc(sizeof(struct elem));
+    if (head == NULL)
+        return 0;      /*No memory available.*/
+    counter = 0;
+   // __disable_irq();
+    do {
+        counter++;
+        current->next = (struct elem*) malloc(sizeof(struct elem));
+        current = current->next;
+    } while (current != NULL);
+    /* Now counter holds the number of type elem
+       structures we were able to allocate. We
+       must free them all before returning. */
+    current = head;
+    do {
+        nextone = current->next;
+        free(current);
+        current = nextone;
+    } while (nextone != NULL);
+   // __enable_irq();
+
+    if (print)
+        dprintf("MemoryAvailable: %d kB (%d bytes)", (counter*FREEMEM_CELL)/1024, counter*FREEMEM_CELL);
+    return counter*FREEMEM_CELL;
+#endif
+}
+
+
+static const char *cmds = \
+	"\r\nThe following commands are available:\r\n\r\n" \
+	" p -- Property Editor\r\n" \
+	" t -- LoRa PingPong Test\r\n" \
+	" x -- LoRa TX Continuous Wave Test\r\n" \
+	" d -- Hexdump of memory address [offset count]\r\n"
+	" r -- Reset\r\n" \
+	" c -- Continue with RadioShuttle\r\n" \
+	"\r\n" \
+	"waiting 10 secs ...\r\n" \
+	"\r\n";
+
+void RunCommands(int timeout_ms) {
+	bool cmdLoop = true;
+	while(cmdLoop) {
+		char buf[32];
+
+		rprintf(cmds);
+		rprintf("Turtle$ ");
+		if (ConsoleReadline(buf, sizeof(buf), true, timeout_ms) == NULL) {
+			cmdLoop = false;
+			break;
+		}
+		switch(buf[0]) {
+			case 'p':
+			case 'P':
+#ifdef FEATURE_NVPROPERTYEDITOR
+				NVPropertyEditor();
+#endif
+			break;
+			case 't':
+			case 'T':
+#ifdef FEATURE_LORA_PING_PONG
+    			SX1276PingPong();	// basic LoRa raw ping/pong without RadioShuttle
+#endif
+				break;
+#ifdef FEATURE_RADIOTESTSAMPLE
+			case 'x':
+			case 'X':
+				RadioContinuesTX();
+#endif
+				break;
+			case 'r':
+			case 'R':
+				MCUReset();
+				break;
+			case 'd':
+			case 'D':
+				{
+					char *addr = strchr(buf, ' ');
+					if (addr) {
+						*addr++ = 0;
+						char *length = strchr(addr, ' ');
+						if (length) {
+							*length++ = 0;
+						}
+						unsigned long address = strtoll(addr, NULL, 0);
+						unsigned long cnt = 32;
+						if (length)
+							cnt = strtoll(length, NULL, 0);
+						dump("Hexdump", (void *)address, cnt);
+					}
+				}
+				break;
+			case 'c':
+			case 'C':
+				cmdLoop = false;
+				break;
+			default:
+				break;
+		}
+	}
+	rprintf("\r\n");
+
+}
--- a/arch.cpp	Fri Feb 15 09:59:09 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * $Id: $
- * This is an unpublished work copyright (c) 2019 HELIOS Software GmbH
- * 30827 Garbsen, Germany
- */
-#include <mbed.h>
-#include "arch.h"
-
-// --------------------------------------------------------------------------------------------------------------------
-#ifndef TOOLCHAIN_GCC
-
-_extern_c size_t strnlen(const char *s, size_t maxlen) {
-    const char *endp = static_cast<const char *>(memchr(s, 0, maxlen));
-    if (endp == NULL) {
-        return maxlen;
-    } else {
-        return endp - s;
-    }
-}
-
-_extern_c char *strdup(const char *s) {
-    size_t sz = strlen(s) + 1;
-    char *news = static_cast<char *>(malloc(sz));
-    if (news) {
-        memcpy(news, s, sz);
-    }
-    return news;
-}
-
-// _extern_c char *stpcpy(char *dest, const char *src) {
-//     size_t l = strlen(src);
-//     memcpy(dest, src, l+1);
-//     return dest + l;
-// }
-
-#endif
-
-// --------------------------------------------------------------------------------------------------------------------
-#ifdef TARGET_STM32L0
-#ifdef TOOLCHAIN_GCC
-_extern_c unsigned int __atomic_fetch_or_4(volatile void *mem, unsigned int val, int model) {
-    volatile unsigned int *ptr = static_cast<volatile unsigned int *>(mem);
-    core_util_critical_section_enter();
-    unsigned int tmp = *ptr;
-    *ptr = tmp | val;
-    core_util_critical_section_exit();
-    return tmp;
-}
-
-_extern_c unsigned int __atomic_exchange_4(volatile void *mem, unsigned int val, int model) {
-    volatile unsigned int *ptr = static_cast<volatile unsigned int *>(mem);
-    core_util_critical_section_enter();
-    unsigned int tmp = *ptr;
-    *ptr = val;
-    core_util_critical_section_exit();
-    return tmp;
-}
-
-#else
-_extern_c bool __user_cmpxchg_1(unsigned char *ptr, unsigned char oldp, unsigned char newp)
-{
-    return !core_util_atomic_cas_u8(ptr, &oldp, newp);
-//     core_util_critical_section_enter();
-//     bool r = (*ptr == oldp);
-//     if (r) {
-//         *ptr = newp;
-//     }
-//     core_util_critical_section_exit();
-//     return !r;
-}
-
-_extern_c bool __user_cmpxchg_4(unsigned int *ptr, unsigned int oldp, unsigned int newp)
-{
-    return !core_util_atomic_cas_u32(ptr, &oldp, newp);
-//     core_util_critical_section_enter();
-//     bool r = (*ptr == oldp);
-//     if (r) {
-//         *ptr = newp;
-//     }
-//     core_util_critical_section_exit();
-//     return !r;
-}
-#endif
-#endif
--- a/arch.h	Fri Feb 15 09:59:09 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,319 +0,0 @@
-/*
- * $Id: config.h,v 1.5 2017/02/23 14:31:38 grimrath Exp $
- * This is an unpublished work copyright (c) 2019 HELIOS Software GmbH
- * 30827 Garbsen, Germany
- */
-#ifndef __ARCH_H__
-#define __ARCH_H__
-
-#ifdef __cplusplus
-#define _extern_c extern "C"
-#else
-#define _extern_c
-#endif
-
-// --------------------------------------------------------------------------------------------------------------------
-// Definitions to adapt between POSIX and MBED
-//
-#ifdef __MBED__
-
-#include <mbed_assert.h>
-#include <mbed_debug.h>
-
-#ifdef TARGET_DEBUG
-#define DEBUG 1
-#define STATIC_ASSERT	MBED_STATIC_ASSERT
-#define ASSERT		MBED_ASSERT
-#else
-#define ASSERT(x)	((void)0)
-#endif
-
-#define STATIC_ASSERT	MBED_STATIC_ASSERT
-
-#ifndef TOOLCHAIN_GCC
-#ifdef __cplusplus
-using std::size_t;
-using std::va_list;
-using std::abort;
-#endif
-
-_extern_c size_t strnlen(const char *s, size_t maxlen);
-_extern_c char *strdup(const char *s);
-_extern_c char *stpcpy(char *dest, const char *src);
-
-#endif
-
-struct iovec {
-    void *  iov_base;
-    size_t  iov_len;
-};
-
-
-static inline unsigned read_systicker_us(void) {
-	extern uint32_t us_ticker_read(void);	// I do not want to include us_ticker_api.h here
-
-	return us_ticker_read();
-}
-
-#define FlashFileSysMount	"Flash"
-// #define ESPFileSysMount     "ESP"
-#define PseudoFileSysMount	"pseudo"
-
-#else // __MBED__
-
-#include <assert.h>
-#include <time.h>
-
-#ifdef __cplusplus
-#define STATIC_ASSERT(condition, msg) ((void)sizeof(char[1 - 2*!(condition)]))
-#else
-#define STATIC_ASSERT(expr, msg)	_Static_assert(expr, msg)  // C11 feature
-#endif
-#define ASSERT				assert
-
-//static inline unsigned read_systicker_us(void) {
-//	struct timespec ts;
-//	clock_gettime(CLOCK_MONOTONIC, &ts);
-//	return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000);
-//}
-
-#endif // __MBED__
-
-
-// --------------------------------------------------------------------------------------------------------------------
-// synchronize memory contents with external peripherals and interrupt handlers
-//
-// __ATOMIC_RELAXED should be ok since we are only dealing with irq handlers on exactly one CPU/MCU
-//
-// __atomic_load_n is not available in the online IDE (yet)
-//
-#if defined(__ATOMIC_RELAXED)
-
-#define help_atomic_load_relaxed(ptr) __atomic_load_n((ptr), __ATOMIC_RELAXED)
-
-#define help_atomic_store_relaxed(ptr, val) __atomic_store_n((ptr), (val), __ATOMIC_RELAXED)
-
-#define help_atomic_readclr_relaxed(ptr) __atomic_exchange_n((ptr), 0, __ATOMIC_RELAXED)
-
-#define help_atomic_or_relaxed(ptr, val) __atomic_fetch_or((ptr), (val), __ATOMIC_RELAXED)
-
-#ifdef __cplusplus
-template<typename T> inline bool help_atomic_compare_and_swap(T *ptr, T checkval, T newval) {
-    return __atomic_compare_exchange_n(ptr, &checkval, newval, false, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
-}
-#else
-#define help_atomic_compare_and_swap(ptr, checkval, newval) __sync_bool_compare_and_swap((ptr), (checkval), (newval))
-#endif
-
-#define sync_memory(mem) do { \
-	asm volatile("" : "=m" (mem)); \
-	__atomic_thread_fence(__ATOMIC_SEQ_CST); \
-} while (0)
-
-#define irq_barrier() __atomic_signal_fence(__ATOMIC_SEQ_CST)
-
-#define sync_memory_all() do { \
-	asm volatile("" : : : "memory"); \
-	__atomic_thread_fence(__ATOMIC_SEQ_CST); \
-} while (0)
-
-#else // defined(__ATOMIC_RELAXED)
-
-#define help_atomic_load_relaxed(ptr) (*(ptr))
-
-#define help_atomic_store_relaxed(ptr, val) ((void)(*(ptr) = (val)))
-
-#define help_atomic_readclr_relaxed(ptr) __sync_fetch_and_and((ptr), 0)
-
-#define help_atomic_or_relaxed(ptr, val) __sync_fetch_and_or((ptr), (val))
-
-#define help_atomic_compare_and_swap(ptr, checkval, newval) __sync_bool_compare_and_swap((ptr), (checkval), (newval))
-
-#define sync_memory(mem) __sync_synchronize()
-
-#define sync_memory_all() __sync_synchronize()
-
-#define irq_barrier() __sync_synchronize()
-
-#endif
-
-
-#define help_atomic_init(ptr, initval) do { *(ptr) = (initval); } while (0)
-
-// --------------------------------------------------------------------------------------------------------------------
-// other
-
-#define ispowerof2(x) (((x) & ((x) - 1)) == 0)
-
-static inline uint32_t alignup32(uint32_t size, uint32_t next) {
-    uint32_t next1 = next - 1;
-    ASSERT((next & next1) == 0);	// 2^n check
-    return (size + next1) & ~next1;
-}
-
-
-// --------------------------------------------------------------------------------------------------------------------
-// typesafe macros to get the number of compile-time known array elements.
-//
-#ifdef __cplusplus
-
-template< typename T, std::size_t N > char(&COUNTOF_REQUIRES_ARRAY_ARGUMENT(T(&)[N]))[N];
-#define ARRAYLEN(x) sizeof(COUNTOF_REQUIRES_ARRAY_ARGUMENT(x))
-
-#else
-
-// MBED OS online compiler does not support unnamed and zero sized bitfields as GCC does
-// #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))	// used by Linux kernel
-#define __must_be_zero(e) (sizeof(struct { char dummy:(1 - 2*!!(e)); }) - 1)
-
-// __builtin_types_compatible_p: gcc extension, but understood by Intel, clang and ARM compilers too
-// __builtin_types_compatible_p is not available in C++
-#define __must_be_array(arr) __must_be_zero(__builtin_types_compatible_p(typeof(arr), typeof(&(arr)[0])))
-
-#define ARRAYLEN(arr) (sizeof(arr) / sizeof(0[arr])) + __must_be_array(arr)
-
-#endif
-
-
-// --------------------------------------------------------------------------------------------------------------------
-// quick int32 -> int conversion mainly for printf. Shorter than static_cast<int> and works with C too.
-//
-static inline int itoi(int val) { return val; }
-static inline long long lltoll(long long val) { return val; }
-
-
-// --------------------------------------------------------------------------------------------------------------------
-// Byte order
-//
-#ifdef __MBED__
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-
-static inline uint16_t htole16(uint16_t x) { return x; }
-static inline uint16_t le16toh(uint16_t x) { return x; }
-static inline uint32_t htole32(uint32_t x) { return x; }
-static inline uint32_t le32toh(uint32_t x) { return x; }
-
-#else
-
-// unused big endian variants
-// static inline uint16_t htobe16(uint16_t x) { return __REV16(x); }
-// static inline uint16_t be16toh(uint16_t x) { return __REV16(x); }
-// static inline uint32_t htobe32(uint32_t x) { return __REV(x); }
-// static inline uint32_t be32toh(uint32_t x) { return __REV(x); }
-
-#endif
-
-#elif defined(__linux__)
-
-#include <endian.h>
-
-#elif defined(__APPLE__)
-
-#include <libkern/OSByteOrder.h>
-#define htole16 OSSwapHostToLittleInt16
-#define le16toh OSSwapHostToLittleInt16
-#define htole32 OSSwapHostToLittleInt32
-#define le32toh OSSwapHostToLittleInt32
-
-#endif
-
-
-// --------------------------------------------------------------------------------------------------------------------
-// memory debugging
-//
-#ifdef DEBUG
-
-#ifdef USE_VALGRIND
-
-#include <valgrind/valgrind.h>
-#include <valgrind/memcheck.h>
-#include <string.h>
-
-#define CHECKDEFINED(obj) VALGRIND_CHECK_MEM_IS_DEFINED(&(obj), sizeof(obj))
-
-#endif // ! valgrind
-
-static inline void POISONMEM(void *ptr, size_t sz) {
-	memset(ptr, 0x55, sz);
-#ifdef USE_VALGRIND
-	VALGRIND_MAKE_MEM_UNDEFINED(ptr, sz);
-#endif
-}
-
-#define POISON(obj) POISONMEM(&(obj), sizeof(obj))
-
-#else // ! DEBUG
-
-#ifdef USE_VALGRIND
-#error valgrind features only useable in debug builds
-#endif
-
-static inline void POISONMEM(void *ptr, size_t sz) { (void)ptr; (void)sz; }
-
-#define POISON(obj)	((void)0)
-
-#endif // DEBUG
-
-// --------------------------------------------------------------------------------------------------------------------
-// Macros to live bookmark code
-//
-#ifdef DEBUG
-
-_extern_c void dbg_fail_handler(const char *file, int line, const char *func, const char *msg) __attribute__((noreturn));
-
-#define TODO(...)	dbg_fail_handler(__FILE__, __LINE__, __func__, "TODO" __VA_ARGS__)
-#define UNTESTED()	dbg_fail_handler(__FILE__, __LINE__, __func__, "UNTESTED")
-#define UNREACHABLE()	dbg_fail_handler(__FILE__, __LINE__, __func__, "UNREACHABLE")
-#if defined(__x86_64__) || defined(__i386__)
-#define BREAKPOINT()	asm("int $3")
-#elif defined(__arm__)
-#define BREAKPOINT()	__BKPT(0)
-#else
-#error no compile time breakpoints supplied for this architecture - add them if needed
-#endif
-
-#else // ! debug
-
-#define TODO(...)	abort()
-#define UNTESTED()	((void)0)
-#ifdef __MBED__
-#	define UNREACHABLE()	MBED_UNREACHABLE
-#else
-#	define UNREACHABLE() __builtin_unreachable()
-#endif
-// no BREAKPOINT() - these must be removed in release builds
-
-#endif // debug
-
-
-
-// --------------------------------------------------------------------------------------------------------------------
-// Tracing
-//
-#ifdef DEBUG
-
-// Do not call these directly, use DTRC
-_extern_c void trc_dbg(const char *file, int line, const char *func, const char *fmt, ...) __attribute__((format(printf,4,5)));
-_extern_c void trc_vdbg(const char *file, int line, const char *func, const char *fmt, va_list ap);
-
-#define DTRC(_fmt, ...) trc_dbg(__FILE__, __LINE__, __func__, (_fmt), ## __VA_ARGS__)
-
-
-#else // DEBUG
-
-#define DTRC(_fmt, ...)	((void)0)
-
-#endif
-
-// Do not call these directly, use TRC_* macros
-_extern_c void trc_printf(const char *fmt, ...) __attribute__((format(printf,1,2)));
-_extern_c void trc_vprintf(const char *fmt, va_list ap);
-
-// These exists even in release builds
-#define TRC_INF(_fmt, ...) trc_printf((_fmt), ## __VA_ARGS__)
-#define TRC_WRN TRC_INF
-#define TRC_ERR TRC_INF
-#define TRC_VERR(fmt, ap) trc_vprintf((fmt), (ap))
-
-#endif // __ARCH_H__
--- a/mbed-util.h	Fri Feb 15 09:59:09 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2019 Helmut Tschemernjak
- * 30826 Garbsen (Hannover) Germany
- * Licensed under the Apache License, Version 2.0);
- */
-
-
-#ifndef __MBED_UTIL_H__
-#define __MBED_UTIL_H__
-
-
-extern int CPUID(uint8_t *buf, int maxSize, uint32_t value);
-extern float BatteryVoltage(void);
-extern void OTPWrite(uint8_t *address, const void *d, size_t length);
-
-
-
-
-#endif // __MBED_UTIL_H__
--- a/mbed-util.s	Fri Feb 15 09:59:09 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,833 +0,0 @@
-#ifdef __ARMCC_VERSION
-; generated by Component: ARM Compiler 5.06 update 4 (build 422) Tool: armcc [4d3604]
-; commandline armcc [--cpp --split_sections -c -S --gnu -oBUILD\NUCLEO_L432KC\ARM\mbed-util.o --depend=BUILD\NUCLEO_L432KC\ARM\mbed-util.d --cpu=Cortex-M4.fp --apcs=interwork -O3 -Otime --preinclude=.\BUILD\NUCLEO_L432KC\ARM\mbed_config.h -I. -I./BulkSerial -I./ESP -I./FATFileSystem -I./FATFileSystem/ChaN -I./Flash -I./Flash/MD5 -I./Hardware-STM -I./NVProperty -I./Power -I./RadioShuttleLib -I./RadioShuttleLib/examples -I./RadioShuttleLib/examples/PMSensorRadio -I./RadioShuttleLib/examples/RadioTest -I./RadioShuttleLib/util -I./STM_MEMS -I./SX1276GenericLib -I./SX1276GenericLib/radio -I./SX1276GenericLib/registers -I./SX1276GenericLib/sx1276 -I./USBDeviceHT -I./USBDeviceHT/USBDevice -I./USBDeviceHT/USBSerial -I./USBDeviceHT/USBSerialBuffered -I./USBDeviceHT/targets/TARGET_STM -I./WIZnetInterface -I./WIZnetInterface/Socket -I./WIZnetInterface/arch -I./WIZnetInterface/arch/ext -I./WIZnetInterface/arch/int -I./WakeUpRTC -I./WakeUpRTC/Device -I./WakeUpRTC/Device/LPC1114_WakeInterruptIn -I./ZModem -I./mbed -I./mbed/e95d10626187 -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4 -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/TARGET_NUCLEO_L432KC -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/device -I./mbed/e95d10626187/TARGET_NUCLEO_L432KC/TARGET_STM/TARGET_STM32L4/device -I./mbed/e95d10626187/drivers -I./mbed/e95d10626187/hal -I./mbed/e95d10626187/platform -D__ASSERT_MSG -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x40000 -DDEVICE_CRC=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -D__FPU_PRESENT=1 -DDEVICE_PORTOUT=1 -DDEVICE_PORTINOUT=1 -DTARGET_RTOS_M4_M7 -DDEVICE_RTC=1 -DDEVICE_SERIAL_ASYNCH=1 -D__CMSIS_RTOS -DDEVICE_USTICKER=1 -DDEVICE_CAN=1 -DTARGET_CORTEX_M -DDEVICE_I2C_ASYNCH=1 -DTARGET_LIKE_CORTEX_M4 -DDEVICE_ANALOGOUT=1 -DTARGET_M4 -DARM_MATH_CM4 -DTARGET_STM32L4 -DDEVICE_SPI_ASYNCH=1 -DDEVICE_LPTICKER=1 -DDEVICE_PWMOUT=1 -DTARGET_STM32L432xC -DMBED_BUILD_TIMESTAMP=1548340964.1 -DTARGET_CORTEX -DDEVICE_I2C=1 -DTRANSACTION_QUEUE_SIZE_SPI=2 -D__CORTEX_M4 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_FAMILY_STM32 -DTARGET_FF_ARDUINO -DDEVICE_PORTIN=1 -DTARGET_RELEASE -DTARGET_STM -DTARGET_STM32L432KC -DDEVICE_SERIAL_FC=1 -DDEVICE_TRNG=1 -DTARGET_LIKE_MBED -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DDEVICE_SPI=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_FLASH=1 -DTARGET_NUCLEO_L432KC -DTOOLCHAIN_ARM -DTOOLCHAIN_ARM_STD --no_vla --multibyte_chars --brief_diagnostics --no_depend_system_headers --restrict --no_rtti .\mbed-util.cpp]
-        THUMB
-        REQUIRE8
-        PRESERVE8
-
-        AREA ||i._Z14BatteryVoltagev||, CODE, READONLY, ALIGN=3
-
-_Z14BatteryVoltagev PROC
-        PUSH     {r4-r7,lr}
-        LDR      r5,|L0.328|
-        VPUSH    {d8}
-        SUB      sp,sp,#0x84
-        LDR      r0,[r5,#0x4c]
-        ORR      r0,r0,#0x2000
-        STR      r0,[r5,#0x4c]
-        LDR      r0,[r5,#0x4c]
-        AND      r0,r0,#0x2000
-        STR      r0,[sp,#0x80]
-        LDR      r0,[r5,#0x88]
-        ORR      r0,r0,#0x30000000
-        STR      r0,[r5,#0x88]
-        LDR      r6,|L0.332|
-        MOV      r0,sp
-        STR      r6,[sp,#0]
-        BL       HAL_ADC_DeInit
-        CMP      r0,#0
-        ITTTT    NE
-        VMOVNE.F32 s0,#1.00000000
-        ADDNE    sp,sp,#0x84
-        VPOPNE   {d8}
-        POPNE    {r4-r7,pc}
-        MOVS     r4,#0
-        MOVS     r7,#4
-        STRD     r4,r7,[sp,#0x10]
-        STR      r4,[sp,#4]
-        STR      r4,[sp,#8]
-        STR      r4,[sp,#0xc]
-        MOVS     r0,#1
-        STR      r4,[sp,#0x18]
-        STRD     r4,r0,[sp,#0x1c]
-        STRD     r4,r0,[sp,#0x24]
-        STR      r4,[sp,#0x2c]
-        LSLS     r0,r0,#12
-        STR      r4,[sp,#0x30]
-        STRD     r4,r0,[sp,#0x34]
-        MOV      r0,sp
-        STR      r4,[sp,#0x3c]
-        BL       HAL_ADC_Init
-        CMP      r0,#0
-        ITTTT    NE
-        VMOVNE.F32 s0,#2.00000000
-        ADDNE    sp,sp,#0x84
-        VPOPNE   {d8}
-        POPNE    {r4-r7,pc}
-        LDR      r0,|L0.336|
-        STR      r0,[sp,#0x68]
-        MOVS     r0,#6
-        STR      r0,[sp,#0x6c]
-        MOVS     r0,#7
-        STR      r0,[sp,#0x70]
-        MOVS     r0,#0x7f
-        STR      r4,[sp,#0x7c]
-        STRD     r0,r7,[sp,#0x74]
-        ADD      r1,sp,#0x68
-        MOV      r0,sp
-        BL       HAL_ADC_ConfigChannel
-        CMP      r0,#0
-        ITTTT    NE
-        VMOVNE.F32 s0,#3.00000000
-        ADDNE    sp,sp,#0x84
-        VPOPNE   {d8}
-        POPNE    {r4-r7,pc}
-        MOVS     r1,#0x7f
-        MOV      r0,sp
-        BL       HAL_ADCEx_Calibration_Start
-        CMP      r0,#0
-        ITTTT    NE
-        VMOVNE.F32 s0,#4.00000000
-        ADDNE    sp,sp,#0x84
-        VPOPNE   {d8}
-        POPNE    {r4-r7,pc}
-        MOV      r0,sp
-        BL       HAL_ADC_Start
-        CMP      r0,#0
-        ITTTT    NE
-        VMOVNE.F32 s0,#5.00000000
-        ADDNE    sp,sp,#0x84
-        VPOPNE   {d8}
-        POPNE    {r4-r7,pc}
-        MOVS     r1,#0xa
-        MOV      r0,sp
-        BL       HAL_ADC_PollForConversion
-        CMP      r0,#0
-        ITTTT    NE
-        VMOVNE.F32 s0,#6.00000000
-        ADDNE    sp,sp,#0x84
-        VPOPNE   {d8}
-        POPNE    {r4-r7,pc}
-        MOV      r0,sp
-        BL       HAL_ADC_GetValue
-        LDR      r1,|L0.340|
-        UDIV     r0,r1,r0
-        BL       __aeabi_ui2d
-        VLDR     d1,|L0.344|
-        VMOV     r2,r3,d1
-        BL       __aeabi_ddiv
-        BL       __aeabi_d2f
-        VMOV     s16,r0
-        MOV      r0,sp
-        BL       ADC_Disable
-        MOV      r0,sp
-        BL       HAL_ADC_DeInit
-        LDR      r0,[r5,#0x88]
-        BIC      r0,r0,#0x30000000
-        STR      r0,[r5,#0x88]
-        LDR      r0,[r5,#0x4c]
-        BIC      r0,r0,#0x2000
-        STR      r0,[r5,#0x4c]
-        LDR      r0,[r6,#8]
-        BIC      r0,r0,#0x1800000
-        STR      r0,[r6,#8]
-        ADD      sp,sp,#0x84
-        VMOV.F32 s0,s16
-        VPOP     {d8}
-        POP      {r4-r7,pc}
-        ENDP
-
-        DCW      0x0000
-|L0.328|
-        DCD      0x40021000
-|L0.332|
-        DCD      0x50040000
-|L0.336|
-        DCD      0x80000001
-|L0.340|
-        DCD      0x004afb50
-|L0.344|
-        DCFD     0x408f400000000000 ; 1000
-
-        AREA ||i._Z5CPUIDPhij||, CODE, READONLY, ALIGN=2
-
-_Z5CPUIDPhij PROC
-        LDR      r3,|L1.48|
-        CMP      r1,#0x10
-        ITT      LT
-        MOVLT    r0,#0
-        BXLT     lr
-        EOR      r1,r3,r2
-        LDR      r2,[r1,#0]
-        STR      r2,[r0,#0]
-        LDR      r2,[r1,#4]
-        STR      r2,[r0,#4]
-        LDR      r1,[r1,#8]
-        STR      r1,[r0,#8]
-        LDR      r1,|L1.52|
-        LDR      r2,|L1.56|
-        LDRB     r1,[r1,#0]
-        LDRH     r2,[r2,#0]
-        AND      r1,r1,#0x1f
-        ORR      r1,r1,r2,LSL #16
-        STR      r1,[r0,#0xc]
-        MOVS     r0,#0x10
-        BX       lr
-        ENDP
-
-|L1.48|
-        DCD      0x4aaa20c5
-|L1.52|
-        DCD      0x1fff7500
-|L1.56|
-        DCD      0x1fff75e0
-
-        AREA ||i._Z8OTPWritePhPKvj||, CODE, READONLY, ALIGN=1
-
-_Z8OTPWritePhPKvj PROC
-        PUSH     {r4-r6,lr}
-        SUB      sp,sp,#8
-        MOV      r6,r2
-        MOV      r4,r1
-        MOV      r5,r0
-        BL       HAL_FLASH_Unlock
-        CBZ      r6,|L2.84|
-|L2.16|
-        LDRB     r0,[r4,#0]
-        STRB     r0,[sp,#0]
-        LDRB     r0,[r4,#1]
-        STRB     r0,[sp,#1]
-        LDRB     r0,[r4,#2]
-        STRB     r0,[sp,#2]
-        LDRB     r0,[r4,#3]
-        STRB     r0,[sp,#3]
-        LDRB     r0,[r4,#4]
-        STRB     r0,[sp,#4]
-        LDRB     r0,[r4,#5]
-        STRB     r0,[sp,#5]
-        LDRB     r0,[r4,#6]
-        STRB     r0,[sp,#6]
-        LDRB     r0,[r4,#7]
-        STRB     r0,[sp,#7]
-        LDRD     r2,r3,[sp,#0]
-        MOV      r1,r5
-        MOVS     r0,#0
-        BL       HAL_FLASH_Program
-        ADDS     r4,r4,#8
-        ADDS     r5,r5,#8
-        SUBS     r6,r6,#8
-        BNE      |L2.16|
-|L2.84|
-        ADD      sp,sp,#8
-        POP      {r4-r6,lr}
-        B.W      HAL_FLASH_Lock
-        ENDP
-
-
-        AREA ||.ARM.exidx||, LINKORDER=||i._Z5CPUIDPhij||, DATA, READONLY, SECTYPE={SHT_ARM_EXIDX}, ALIGN=2
-
-        DCD      0x00000000
-        RELOC 42, ||i._Z5CPUIDPhij||
-        DCD      0x00000001
-
-        AREA ||area_number.4||, LINKORDER=||i._Z14BatteryVoltagev||, DATA, READONLY, SECTYPE={SHT_ARM_EXIDX}, ALIGN=2
-
-        EXPORTAS ||area_number.4||, ||.ARM.exidx||
-        DCD      0x00000000
-        RELOC 42, ||i._Z14BatteryVoltagev||
-        DCD      0x00000001
-
-        AREA ||area_number.5||, LINKORDER=||i._Z8OTPWritePhPKvj||, DATA, READONLY, SECTYPE={SHT_ARM_EXIDX}, ALIGN=2
-
-        EXPORTAS ||area_number.5||, ||.ARM.exidx||
-        DCD      0x00000000
-        RELOC 42, ||i._Z8OTPWritePhPKvj||
-        DCD      0x00000001
-
-        AREA ||.arm_vfe_header||, DATA, READONLY, NOALLOC, ALIGN=2
-
-        DCD      0x00000000
-
-;*** Start embedded assembler ***
-
-#line 1 ".\\mbed-util.cpp"
-	AREA ||.rev16_text||, CODE
-	THUMB
-	EXPORT |__asm___13_mbed_util_cpp_f390ad65___Z7__REV16j|
-#line 468 "./mbed/e95d10626187/TARGET_NUCLEO_L432KC/cmsis_armcc.h"
-|__asm___13_mbed_util_cpp_f390ad65___Z7__REV16j| PROC
-#line 469
-
- rev16 r0, r0
- bx lr
-	ENDP
-	AREA ||.revsh_text||, CODE
-	THUMB
-	EXPORT |__asm___13_mbed_util_cpp_f390ad65___Z7__REVSHs|
-#line 483
-|__asm___13_mbed_util_cpp_f390ad65___Z7__REVSHs| PROC
-#line 484
-
- revsh r0, r0
- bx lr
-	ENDP
-	AREA ||.rrx_text||, CODE
-	THUMB
-	EXPORT |__asm___13_mbed_util_cpp_f390ad65___Z5__RRXj|
-#line 670
-|__asm___13_mbed_util_cpp_f390ad65___Z5__RRXj| PROC
-#line 671
-
- rrx r0, r0
- bx lr
-	ENDP
-
-;*** End   embedded assembler ***
-
-        EXPORT _Z14BatteryVoltagev [CODE]
-        EXPORT _Z5CPUIDPhij [CODE]
-        EXPORT _Z8OTPWritePhPKvj [CODE]
-
-        IMPORT ||Lib$$Request$$armlib|| [CODE,WEAK]
-        IMPORT ||Lib$$Request$$cpplib|| [CODE,WEAK]
-        IMPORT HAL_ADC_DeInit [CODE]
-        IMPORT HAL_ADC_Init [CODE]
-        IMPORT HAL_ADC_ConfigChannel [CODE]
-        IMPORT HAL_ADCEx_Calibration_Start [CODE]
-        IMPORT HAL_ADC_Start [CODE]
-        IMPORT HAL_ADC_PollForConversion [CODE]
-        IMPORT HAL_ADC_GetValue [CODE]
-        IMPORT __aeabi_ui2d [CODE]
-        IMPORT __aeabi_ddiv [CODE]
-        IMPORT __aeabi_d2f [CODE]
-        IMPORT ADC_Disable [CODE]
-        IMPORT HAL_FLASH_Unlock [CODE]
-        IMPORT HAL_FLASH_Program [CODE]
-        IMPORT HAL_FLASH_Lock [CODE]
-
-        ATTR FILESCOPE
-        ATTR SETVALUE Tag_ABI_PCS_wchar_t,2
-        ATTR SETVALUE Tag_ABI_enum_size,1
-        ATTR SETVALUE Tag_ABI_optimization_goals,2
-        ATTR SETSTRING Tag_conformance,"2.09"
-        ATTR SETVALUE AV,6,0
-        ATTR SETVALUE AV,18,1
-
-        ASSERT {ENDIAN} = "little"
-        ASSERT {INTER} = {TRUE}
-        ASSERT {ROPI} = {FALSE}
-        ASSERT {RWPI} = {FALSE}
-        ASSERT {IEEE_FULL} = {FALSE}
-        ASSERT {IEEE_PART} = {FALSE}
-        ASSERT {IEEE_JAVA} = {FALSE}
-        END
-#elif defined(__GNUC__)
-	.cpu cortex-m4
-	.eabi_attribute 27, 1
-	.eabi_attribute 20, 1
-	.eabi_attribute 21, 1
-	.eabi_attribute 23, 3
-	.eabi_attribute 24, 1
-	.eabi_attribute 25, 1
-	.eabi_attribute 26, 1
-	.eabi_attribute 30, 4
-	.eabi_attribute 34, 1
-	.eabi_attribute 18, 4
-	.file	"mbed-util.cpp"
-	.text
-.Ltext0:
-	.cfi_sections	.debug_frame
-	.section	.text._Z5CPUIDPhim,"ax",%progbits
-	.align	1
-	.global	_Z5CPUIDPhim
-	.arch armv7e-m
-	.syntax unified
-	.thumb
-	.thumb_func
-	.fpu fpv4-sp-d16
-	.type	_Z5CPUIDPhim, %function
-_Z5CPUIDPhim:
-.LFB2093:
-	.file 1 "./mbed-util.cpp"
-	.loc 1 22 1
-	.cfi_startproc
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 0, uses_anonymous_args = 0
-.LBB2:
-	.loc 1 28 5
-	cmp	r1, #15
-.LBE2:
-	.loc 1 22 1
-	push	{r0, r1, r2, lr}
-	.cfi_def_cfa_offset 16
-	.cfi_offset 14, -4
-	.loc 1 22 1
-	mov	r3, r0
-.LBB5:
-	.loc 1 28 5
-	ble	.L4
-.LBB3:
-	.loc 1 30 21
-	ldr	r1, .L6
-	eors	r1, r1, r2
-	adds	r0, r0, #12
-	subs	r1, r1, r3
-.L3:
-.LBB4:
-	.loc 1 34 19 discriminator 2
-	ldrb	r2, [r3, r1]	@ zero_extendqisi2
-	.loc 1 34 17 discriminator 2
-	strb	r2, [r3], #1
-	.loc 1 33 27 discriminator 2
-	cmp	r0, r3
-	bne	.L3
-.LBE4:
-	.loc 1 36 19
-	ldr	r3, .L6+4
-	ldrh	r2, [r3]
-	.loc 1 36 64
-	subs	r3, r3, #224
-	.loc 1 36 101
-	ldrh	r3, [r3]
-	and	r3, r3, #31
-	.loc 1 36 60
-	orr	r3, r3, r2, lsl #16
-	.loc 1 37 9
-	movs	r2, #4
-	add	r1, sp, r2
-	.loc 1 36 12
-	str	r3, [sp, #4]
-	.loc 1 37 9
-	bl	memcpy
-	.loc 1 39 16
-	movs	r0, #16
-.L1:
-.LBE3:
-.LBE5:
-	.loc 1 42 1
-	add	sp, sp, #12
-	.cfi_remember_state
-	.cfi_def_cfa_offset 4
-	@ sp needed
-	ldr	pc, [sp], #4
-.L4:
-	.cfi_restore_state
-	.loc 1 41 12
-	movs	r0, #0
-	b	.L1
-.L7:
-	.align	2
-.L6:
-	.word	1252663493
-	.word	536835552
-	.cfi_endproc
-.LFE2093:
-	.size	_Z5CPUIDPhim, .-_Z5CPUIDPhim
-	.global	__aeabi_ui2d
-	.global	__aeabi_ddiv
-	.global	__aeabi_d2f
-	.section	.text._Z14BatteryVoltagev,"ax",%progbits
-	.align	1
-	.global	_Z14BatteryVoltagev
-	.syntax unified
-	.thumb
-	.thumb_func
-	.fpu fpv4-sp-d16
-	.type	_Z14BatteryVoltagev, %function
-_Z14BatteryVoltagev:
-.LFB2094:
-	.loc 1 48 1
-	.cfi_startproc
-	@ args = 0, pretend = 0, frame = 136
-	@ frame_needed = 0, uses_anonymous_args = 0
-	push	{r4, r5, r6, r7, lr}
-	.cfi_def_cfa_offset 20
-	.cfi_offset 4, -20
-	.cfi_offset 5, -16
-	.cfi_offset 6, -12
-	.cfi_offset 7, -8
-	.cfi_offset 14, -4
-.LBB6:
-	.loc 1 60 5
-	ldr	r4, .L16
-.LBE6:
-	.loc 1 66 24
-	ldr	r6, .L16+4
-.LBB7:
-	.loc 1 60 5
-	ldr	r3, [r4, #76]
-	orr	r3, r3, #8192
-	str	r3, [r4, #76]
-	ldr	r3, [r4, #76]
-.LBE7:
-	.loc 1 48 1
-	sub	sp, sp, #140
-	.cfi_def_cfa_offset 160
-.LBB8:
-	.loc 1 60 5
-	and	r3, r3, #8192
-	str	r3, [sp, #4]
-	ldr	r3, [sp, #4]
-.LBE8:
-	.loc 1 62 5
-	ldr	r3, [r4, #136]
-	orr	r3, r3, #805306368
-	str	r3, [r4, #136]
-	.loc 1 67 23
-	add	r0, sp, #32
-	.loc 1 66 24
-	str	r6, [sp, #32]
-	.loc 1 67 23
-	bl	HAL_ADC_DeInit
-	.loc 1 67 5
-	cmp	r0, #0
-	bne	.L10
-	.loc 1 77 42
-	movs	r3, #1
-	.loc 1 78 42
-	strd	r3, r0, [sp, #64]
-	.loc 1 80 42
-	strd	r3, r0, [sp, #72]
-	.loc 1 74 42
-	movs	r7, #4
-	.loc 1 83 42
-	mov	r3, #4096
-	.loc 1 71 42
-	strd	r0, r0, [sp, #36]
-	.loc 1 73 42
-	strd	r0, r0, [sp, #44]
-	.loc 1 75 42
-	strd	r7, r0, [sp, #52]
-	.loc 1 76 42
-	str	r0, [sp, #60]
-	.loc 1 82 42
-	strd	r0, r0, [sp, #80]
-	.loc 1 84 42
-	strd	r3, r0, [sp, #88]
-	.loc 1 86 21
-	add	r0, sp, #32
-	bl	HAL_ADC_Init
-	.loc 1 86 5
-	cmp	r0, #0
-	bne	.L11
-	.loc 1 92 26
-	ldr	r2, .L16+8
-	movs	r3, #6
-	strd	r2, r3, [sp, #8]
-	.loc 1 94 26
-	movs	r5, #127
-	movs	r3, #7
-	.loc 1 96 20
-	strd	r7, r0, [sp, #24]
-	.loc 1 98 30
-	add	r1, sp, #8
-	add	r0, sp, #32
-	.loc 1 94 26
-	strd	r3, r5, [sp, #16]
-	.loc 1 98 30
-	bl	HAL_ADC_ConfigChannel
-	.loc 1 98 5
-	cmp	r0, #0
-	bne	.L12
-	.loc 1 117 36
-	mov	r1, r5
-	add	r0, sp, #32
-	bl	HAL_ADCEx_Calibration_Start
-	.loc 1 117 5
-	cmp	r0, #0
-	bne	.L13
-	.loc 1 123 22
-	add	r0, sp, #32
-	bl	HAL_ADC_Start
-	.loc 1 123 5
-	cmp	r0, #0
-	bne	.L14
-	.loc 1 132 34
-	movs	r1, #10
-	add	r0, sp, #32
-	bl	HAL_ADC_PollForConversion
-	.loc 1 132 5
-	cmp	r0, #0
-	bne	.L15
-	.loc 1 141 38
-	add	r0, sp, #32
-	bl	HAL_ADC_GetValue
-	.loc 1 147 54
-	ldr	r3, .L16+12
-	udiv	r0, r3, r0
-	bl	__aeabi_ui2d
-	ldr	r3, .L16+16
-	movs	r2, #0
-	bl	__aeabi_ddiv
-	.loc 1 147 11
-	bl	__aeabi_d2f
-	mov	r5, r0	@ float
-	.loc 1 149 16
-	add	r0, sp, #32
-	bl	ADC_Disable
-	.loc 1 150 19
-	add	r0, sp, #32
-	bl	HAL_ADC_DeInit
-	.loc 1 159 5
-	ldr	r3, [r4, #136]
-	bic	r3, r3, #805306368
-	str	r3, [r4, #136]
-	.loc 1 160 5
-	ldr	r3, [r4, #76]
-	bic	r3, r3, #8192
-	str	r3, [r4, #76]
-	.loc 1 163 14
-	ldr	r3, [r6, #8]
-	bic	r3, r3, #25165824
-	str	r3, [r6, #8]
-.L8:
-	.loc 1 169 1
-	mov	r0, r5	@ float
-	add	sp, sp, #140
-	.cfi_remember_state
-	.cfi_def_cfa_offset 20
-	@ sp needed
-	pop	{r4, r5, r6, r7, pc}
-.L10:
-	.cfi_restore_state
-	.loc 1 68 16
-	mov	r5, #1065353216
-	b	.L8
-.L11:
-	.loc 1 87 16
-	mov	r5, #1073741824
-	b	.L8
-.L12:
-	.loc 1 99 16
-	ldr	r5, .L16+20
-	b	.L8
-.L13:
-	.loc 1 119 16
-	mov	r5, #1082130432
-	b	.L8
-.L14:
-	.loc 1 125 16
-	ldr	r5, .L16+24
-	b	.L8
-.L15:
-	.loc 1 134 16
-	ldr	r5, .L16+28
-	b	.L8
-.L17:
-	.align	2
-.L16:
-	.word	1073876992
-	.word	1342439424
-	.word	-2147483647
-	.word	4914000
-	.word	1083129856
-	.word	1077936128
-	.word	1084227584
-	.word	1086324736
-	.cfi_endproc
-.LFE2094:
-	.size	_Z14BatteryVoltagev, .-_Z14BatteryVoltagev
-	.section	.text._Z8OTPWritePhPKvj,"ax",%progbits
-	.align	1
-	.global	_Z8OTPWritePhPKvj
-	.syntax unified
-	.thumb
-	.thumb_func
-	.fpu fpv4-sp-d16
-	.type	_Z8OTPWritePhPKvj, %function
-_Z8OTPWritePhPKvj:
-.LFB2095:
-	.loc 1 174 1
-	.cfi_startproc
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 0, uses_anonymous_args = 0
-	push	{r0, r1, r2, r4, r5, r6, r7, lr}
-	.cfi_def_cfa_offset 32
-	.cfi_offset 4, -20
-	.cfi_offset 5, -16
-	.cfi_offset 6, -12
-	.cfi_offset 7, -8
-	.cfi_offset 14, -4
-	.loc 1 174 1
-	mov	r5, r0
-	mov	r6, r1
-	mov	r7, r2
-	.loc 1 179 18
-	bl	HAL_FLASH_Unlock
-	movs	r4, #0
-.L21:
-	.loc 1 180 16
-	cmn	r7, r4
-	sub	r0, r6, r4
-	sub	r1, r5, r4
-	beq	.L19
-	movs	r3, #0
-.L20:
-.LBB9:
-.LBB10:
-	.loc 1 182 33 discriminator 2
-	ldrb	r2, [r0, r3]	@ zero_extendqisi2
-	strb	r2, [sp, r3]
-	adds	r3, r3, #1
-	.loc 1 181 25 discriminator 2
-	cmp	r3, #8
-	bne	.L20
-.LBE10:
-	.loc 1 184 23
-	ldrd	r2, [sp]
-	movs	r0, #0
-	bl	HAL_FLASH_Program
-	subs	r4, r4, #8
-.LBE9:
-	.loc 1 180 2
-	b	.L21
-.L19:
-	.loc 1 189 19
-	bl	HAL_FLASH_Lock
-	.loc 1 190 1
-	add	sp, sp, #12
-	.cfi_def_cfa_offset 20
-	@ sp needed
-	pop	{r4, r5, r6, r7, pc}
-	.cfi_endproc
-.LFE2095:
-	.size	_Z8OTPWritePhPKvj, .-_Z8OTPWritePhPKvj
-	.text
-.Letext0:
-	.section	.debug_info,"",%progbits
-.Ldebug_info0:
-	.4byte	0x64
-	.2byte	0x4
-	.4byte	.Ldebug_abbrev0
-	.byte	0x4
-	.uleb128 0x1
-	.4byte	.LASF6
-	.byte	0x4
-	.4byte	.LASF7
-	.4byte	.LASF8
-	.4byte	.Ldebug_ranges0+0
-	.4byte	0
-	.4byte	.Ldebug_line0
-	.uleb128 0x2
-	.4byte	.LASF0
-	.byte	0x1
-	.byte	0xad
-	.byte	0x6
-	.4byte	.LASF2
-	.4byte	.LFB2095
-	.4byte	.LFE2095-.LFB2095
-	.uleb128 0x1
-	.byte	0x9c
-	.uleb128 0x2
-	.4byte	.LASF1
-	.byte	0x1
-	.byte	0x2f
-	.byte	0x1
-	.4byte	.LASF3
-	.4byte	.LFB2094
-	.4byte	.LFE2094-.LFB2094
-	.uleb128 0x1
-	.byte	0x9c
-	.uleb128 0x2
-	.4byte	.LASF4
-	.byte	0x1
-	.byte	0x15
-	.byte	0x1
-	.4byte	.LASF5
-	.4byte	.LFB2093
-	.4byte	.LFE2093-.LFB2093
-	.uleb128 0x1
-	.byte	0x9c
-	.byte	0
-	.section	.debug_abbrev,"",%progbits
-.Ldebug_abbrev0:
-	.uleb128 0x1
-	.uleb128 0x11
-	.byte	0x1
-	.uleb128 0x25
-	.uleb128 0xe
-	.uleb128 0x13
-	.uleb128 0xb
-	.uleb128 0x3
-	.uleb128 0xe
-	.uleb128 0x1b
-	.uleb128 0xe
-	.uleb128 0x55
-	.uleb128 0x17
-	.uleb128 0x11
-	.uleb128 0x1
-	.uleb128 0x10
-	.uleb128 0x17
-	.byte	0
-	.byte	0
-	.uleb128 0x2
-	.uleb128 0x2e
-	.byte	0
-	.uleb128 0x3f
-	.uleb128 0x19
-	.uleb128 0x3
-	.uleb128 0xe
-	.uleb128 0x3a
-	.uleb128 0xb
-	.uleb128 0x3b
-	.uleb128 0xb
-	.uleb128 0x39
-	.uleb128 0xb
-	.uleb128 0x6e
-	.uleb128 0xe
-	.uleb128 0x11
-	.uleb128 0x1
-	.uleb128 0x12
-	.uleb128 0x6
-	.uleb128 0x40
-	.uleb128 0x18
-	.uleb128 0x2116
-	.uleb128 0x19
-	.byte	0
-	.byte	0
-	.byte	0
-	.section	.debug_aranges,"",%progbits
-	.4byte	0x2c
-	.2byte	0x2
-	.4byte	.Ldebug_info0
-	.byte	0x4
-	.byte	0
-	.2byte	0
-	.2byte	0
-	.4byte	.LFB2093
-	.4byte	.LFE2093-.LFB2093
-	.4byte	.LFB2094
-	.4byte	.LFE2094-.LFB2094
-	.4byte	.LFB2095
-	.4byte	.LFE2095-.LFB2095
-	.4byte	0
-	.4byte	0
-	.section	.debug_ranges,"",%progbits
-.Ldebug_ranges0:
-	.4byte	.LFB2093
-	.4byte	.LFE2093
-	.4byte	.LFB2094
-	.4byte	.LFE2094
-	.4byte	.LFB2095
-	.4byte	.LFE2095
-	.4byte	0
-	.4byte	0
-	.section	.debug_line,"",%progbits
-.Ldebug_line0:
-	.section	.debug_str,"MS",%progbits,1
-.LASF8:
-	.ascii	"/Volumes/Data/work/mbed-work/Turtle_RadioShuttle\000"
-.LASF7:
-	.ascii	"./mbed-util.cpp\000"
-.LASF0:
-	.ascii	"OTPWrite\000"
-.LASF5:
-	.ascii	"_Z5CPUIDPhim\000"
-.LASF4:
-	.ascii	"CPUID\000"
-.LASF3:
-	.ascii	"_Z14BatteryVoltagev\000"
-.LASF6:
-	.ascii	"GNU C++98 8.2.1 20181213 (release) [gcc-8-branch re"
-	.ascii	"vision 267074] -mcpu=cortex-m4 -mthumb -mfpu=fpv4-s"
-	.ascii	"p-d16 -mfloat-abi=softfp -march=armv7e-m+fp -g1 -Os"
-	.ascii	" -std=gnu++98 -fno-rtti -fmessage-length=0 -fno-exc"
-	.ascii	"eptions -fno-builtin -ffunction-sections -fdata-sec"
-	.ascii	"tions -funsigned-char -fno-delete-null-pointer-chec"
-	.ascii	"ks -fomit-frame-pointer\000"
-.LASF1:
-	.ascii	"BatteryVoltage\000"
-.LASF2:
-	.ascii	"_Z8OTPWritePhPKvj\000"
-	.ident	"GCC: (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.1 20181213 (release) [gcc-8-branch revision 267074]"
-#endif
--- a/utils.cpp	Fri Feb 15 09:59:09 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,516 +0,0 @@
-/*
- * Copyright (c) 2019 Helmut Tschemernjak
- * 30826 Garbsen (Hannover) Germany
- */
-#include "main.h"
-#include "GenericPingPong.h"
-#include "RadioTest.h"
-#ifdef TOOLCHAIN_GCC
-#include <malloc.h>
-#endif
-
-volatile uint32_t PendingInterrupts;	// global interrupt mask of received interrupts
-
-time_t cvt_date(char const *date, char const *time);
-
-static float GetBrownOutVolt(void);
-
-BufferedSerial *ser;
-#ifdef FEATURE_USBSERIAL
-USBSerialBuffered *usb;
-#endif
-bool _useDprintf;
-
-void InitSerial(int timeout, DigitalOut *led)
-{
-    _useDprintf = true;
-    bool uartActive = true;
-	
-#ifdef FEATURE_USBSERIAL
-	DigitalOut rx(USBRX);  // need to turn rx low to avoid floating signal
-    rx = 0;
-	DigitalIn uartRX(USBRX);
-	uartActive = uartRX.read();
-    if (!uartActive) {
-        usb = new USBSerialBuffered();
-        Timer t;
-        t.start();
-        while(!usb->connected()) {
-            if (led)
-                *led = !*led;
-            wait_ms(100);
-            if (timeout) {
-                if (t.read_ms() >= timeout) {
-					delete usb;
-					usb = NULL;
-					DigitalOut rx(USBRX);
-					rx = 0; // need to turn tx low to avoid floating signal
-					break;
-				}
-			}
-		}
-	}
-#endif
-	if (uartActive) {
-        ser = new BufferedSerial(USBTX, USBRX);
-        ser->baud(230400);
-        ser->format(8);
-    }
-
-    time_t t = cvt_date(__DATE__, __TIME__);
-    if (t > time(NULL)) {
-        set_time(t);
-    }
-}
-
-void RunStartup(void)
-{
-	rprintf("\r\n");
-    int mbedversion = 9999;
-#ifdef MBED_LIBRARY_VERSION // not available in mbed head compiles
-    mbedversion = MBED_LIBRARY_VERSION;
-#endif
-    dprintf("Turtle: %d.%d (%s %s mbed: v%d)", MAJOR_VERSION, MINOR_VERSION, __DATE__, __TIME__, mbedversion);
-
-    dprintf("SysClock: %u Hz.", (unsigned int)SystemCoreClock);
-#ifdef __ARMCC_VERSION
-    dprintf("ARM Compiler Version: 0x%x", __ARMCC_VERSION);
-#elif __GNUC__
-    dprintf("GCC Compiler Version: %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
-#endif
-	
-	const char *errstr;
-	if (__HAL_RCC_GET_FLAG(RCC_FLAG_BORRST) != RESET)
-		errstr = "RESET OCCURRED";
-	else
-	 	errstr = "initalized";
-	
-    dprintf("Brown Out Reset %s (%1.1f V)", errstr, GetBrownOutVolt());
-    dprintf("Voltage: %.2f (%s powered)", BatteryVoltage(), BatterySource());
-
-	dprintf("InitDefaults Done");
-	MemoryAvailable(true);
-	
-    __HAL_RCC_CLEAR_RESET_FLAGS();
-}
-void printTimeStamp()
-{
-    static LowPowerTimer *timer;
-    if (!timer) {
-        timer = new LowPowerTimer();
-        timer->start();
-    }
-    time_t seconds = time(NULL);
-    struct tm *tm = localtime(&seconds);
-    int usecs = timer->read_us();
-    if (usecs < 0) {
-        usecs = 0;
-        timer->stop();
-        timer->reset();
-        timer->start();
-    }
-    int msecs = usecs % 1000000;
-    
-    rprintf("%02d:%02d:%02d.%06d ", tm->tm_hour, tm->tm_min, tm->tm_sec, msecs);
-}
-
-void dprintf(const char *format, ...)
-{
-    std::va_list arg;
-
-    va_start(arg, format);
-    VAprintf(true, true, _useDprintf, format, arg);
-    va_end(arg);
-}
-
-void rprintf(const char *format, ...)
-{
-    std::va_list arg;
-
-    va_start(arg, format);
-    VAprintf(false, false, _useDprintf, format, arg);
-    va_end(arg);   
-}
-
-void VAprintf(bool timstamp, bool newline, bool printEnabled, const char *format, va_list arg)
-{
-     if (!printEnabled)
-        return;
-
-    if (timstamp)
-        printTimeStamp();
-#ifdef FEATURE_USBSERIAL
-    if (usb) {
-        usb->vprintf_irqsafe(format, arg);
-        if (newline)
-            usb->printf_irqsafe("\r\n");
-	}
-#endif
-    if (ser) {
-        // serial jas 
-        int r = 0;
-        r = vsnprintf(NULL, 0, format, arg);
-        if (r < 82) {
-            char buffer[82+1];
-
-            vsnprintf(buffer, sizeof(buffer), format, arg);
-            r = ser->write(buffer, r);
-        } else {
-            char *buffer = new char[r+1];
-            if (buffer) {
-                vsnprintf(buffer, r+1, format, arg);
-                r = ser->write(buffer, r);
-                delete[] buffer;
-            } else {
-                error("%s %d cannot alloc memory (%d bytes)!\r\n", __FILE__, __LINE__, r+1);
-                r = 0;
-            }
-        }
-        if (newline)
-            ser->write("\r\n", 2);
-    }
-}
-
-char *ConsoleReadline(char *buf, int buflen, bool echo, int timeout_ms)
-{
-	int count = 0;
-	memset(buf, 0, buflen);
-	
-#ifdef FEATURE_USBSERIAL
-	if (usb == NULL && ser == NULL)
-		return NULL;
-#else
-	if (ser == NULL)
-		return NULL;
-#endif
-	
-	Timer t;
-	int start = 0;
-	if (timeout_ms) {
-		t.start();
-		start = t.read_ms();
-	}
-	
-#ifdef FEATURE_USBSERIAL
-	if (usb) {
-		usb->flush();
-		while(usb->readable())
-			usb->getc(); // flush old chars
-	}
-#endif
-	if (ser) {
-		while(ser->readable())
-			ser->getc(); // flush old chars
-	}
-		
-	while(true) {
-		if (timeout_ms && t.read_ms() - start > timeout_ms)
-			return NULL;
-		int c = -2;
-#ifdef FEATURE_USBSERIAL
-		if (usb && usb->readable())
-			c = usb->getc();
-#endif
-		if (ser && ser->readable())
-			c = ser->getc();
-		if (c == -2)
-			continue;
-		
-		if (c == 0 || c == -1  || c == '\r' || c == '\n' ||	c == 3 || c == 4)
-			break;
-		if (c == '\b' || c == 0x7f) { // backspace
-			if (count < 1)
-				continue;
-			buf[--count] = 0;
-			if (echo)
-				rprintf("\b \b");
-#ifdef FEATURE_USBSERIAL
-			if (usb)
-				usb->flush();
-#endif
-			continue;
-		}
-		if (echo) {
-			rprintf("%c", c);
-#ifdef FEATURE_USBSERIAL
-			if (usb)
-				usb->flush();
-#endif
-		}
-		
-		start = t.read_ms();
-		buf[count] = c;
-		if (count++ >= buflen-2)
-			break;
-		// dprintf("Got char: '%c'(%d)", c, c);
-	}
-	
-	if (echo)
-		rprintf("\r\n");
-	if (count)
-		return buf;
-	return NULL;
-}
-
-
-void dump(const char *title, void *data, int len)
-{
-	dump(title, data,  len, false);
-}
-
-void dump(const char *title, const void *data, int len, bool dwords)
-{
-    dprintf("dump(\"%s\", 0x%x, %d bytes)", title, (unsigned int)data, len);
-
-    int i, j, cnt;
-    unsigned char *u;
-    const int width = 16;
-    const int seppos = 7;
-
-    cnt = 0;
-    u = (unsigned char *)data;
-    while (len > 0) {
-        rprintf("%08x: ", (unsigned int)data + cnt);
-        if (dwords) {
-            unsigned int *ip = ( unsigned int *)u;
-            rprintf(" 0x%08x\r\n", *ip);
-            u+= 4;
-            len -= 4;
-            cnt += 4;
-            continue;
-        }
-        cnt += width;
-        j = len < width ? len : width;
-        for (i = 0; i < j; i++) {
-            rprintf("%2.2x ", *(u + i));
-            if (i == seppos)
-                rprintf(" ");
-        }
-        rprintf(" ");
-        if (j < width) {
-            i = width - j;
-            if (i > seppos + 1)
-                rprintf(" ");
-            while (i--) {
-                rprintf("%s", "   ");
-            }
-        }
-        for (i = 0; i < j; i++) {
-            int c = *(u + i);
-            if (c >= ' ' && c <= '~')
-                rprintf("%c", c);
-            else
-                rprintf(".");
-            if (i == seppos)
-                rprintf(" ");
-        }
-        len -= width;
-        u += width;
-        rprintf("\r\n");
-		if (ser)
-			wait_ms(5); // give the serial some time.
-    }
-    rprintf("--\r\n");
-}
-
-/*
- * Convert compile time to system time
- */
-time_t
-cvt_date(char const *date, char const *time)
-{
-    char s_month[5];
-    int year;
-    struct tm t;
-    static const char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
-    sscanf(date, "%s %d %d", s_month, &t.tm_mday, &year);
-    sscanf(time, "%2d %*c %2d %*c %2d", &t.tm_hour, &t.tm_min, &t.tm_sec);
-    // Find where is s_month in month_names. Deduce month value.
-    t.tm_mon = (strstr(month_names, s_month) - month_names) / 3;
-    t.tm_year = year - 1900;
-    return (int)mktime(&t);
-}
-
-
-
-void InterrruptMSG(enum InterrruptDevice irqid) {
-        help_atomic_or_relaxed(&PendingInterrupts, irqid);
-}
-
-
-uint32_t readclrPendingInterrupts() {
-	return help_atomic_readclr_relaxed(&PendingInterrupts);
-}
-
-uint32_t readPendingInterrupts() {
-	return help_atomic_load_relaxed(&PendingInterrupts);
-}
-
-const char *
-BatterySource(void)
-{
-    const char *pwrSource = "Battery";
-#ifdef BATPOWER_EN
-    {
-        DigitalIn pwr(BATPOWER_EN);
-        if (pwr == BATPOWER_EXT)
-            pwrSource = "USB";
-    }
-#endif
-	return pwrSource;
-}
-
-
-float
-GetBrownOutVolt(void)
-{
-		unsigned int *FlashOptionRegister = (unsigned int *)0x1FFF7800;
-		
-		int val = *FlashOptionRegister >> 8 & 0x7; // masking out the BOR bits 9-11
-		switch(val) {
-			case 0:
-				return 1.7;
-			case 1:
-				return 2.0;
-			case 2:
-				return 2.2;
-			case 3:
-				return 2.5;
-			case 4:
-				return 2.8;
-			default:
-				return 999;
-		}
-}
-
-void MCUReset(void)
-{
-    #define AIRCR_VECTKEY_MASK    0x05FA0000
-    SCB->AIRCR = AIRCR_VECTKEY_MASK | 0x04; // NVIC_GenerateSystemReset();
-}
-
-
-#define FREEMEM_CELL    100
-
-struct elem { /* Definition of a structure that is FREEMEM_CELL bytes  in size.) */
-    struct elem *next;
-    char dummy[FREEMEM_CELL-2];
-};
-
-size_t
-MemoryAvailable(bool print)
-{
-    size_t counter;
-#ifdef TOOLCHAIN_GCC
-    struct mallinfo mi = mallinfo();
-    extern char end[];
-    extern char _estack[];
-    counter = (_estack - end) - mi.uordblks;
-    if (print)
-        dprintf("MemoryAvailable: %d kB (%d bytes)", counter/1024, counter);
-    return counter;
-#else
-    struct elem *head, *current, *nextone;
-    current = head = (struct elem*) malloc(sizeof(struct elem));
-    if (head == NULL)
-        return 0;      /*No memory available.*/
-    counter = 0;
-   // __disable_irq();
-    do {
-        counter++;
-        current->next = (struct elem*) malloc(sizeof(struct elem));
-        current = current->next;
-    } while (current != NULL);
-    /* Now counter holds the number of type elem
-       structures we were able to allocate. We
-       must free them all before returning. */
-    current = head;
-    do {
-        nextone = current->next;
-        free(current);
-        current = nextone;
-    } while (nextone != NULL);
-   // __enable_irq();
-
-    if (print)
-        dprintf("MemoryAvailable: %d kB (%d bytes)", (counter*FREEMEM_CELL)/1024, counter*FREEMEM_CELL);
-    return counter*FREEMEM_CELL;
-#endif
-}
-
-
-static const char *cmds = \
-	"\r\nThe following commands are available:\r\n\r\n" \
-	" p -- Property Editor\r\n" \
-	" t -- LoRa PingPong Test\r\n" \
-	" x -- LoRa TX Continuous Wave Test\r\n" \
-	" d -- Hexdump of memory address [offset count]\r\n"
-	" r -- Reset\r\n" \
-	" c -- Continue with RadioShuttle\r\n" \
-	"\r\n" \
-	"waiting 10 secs ...\r\n" \
-	"\r\n";
-
-void RunCommands(int timeout_ms) {
-	bool cmdLoop = true;
-	while(cmdLoop) {
-		char buf[32];
-
-		rprintf(cmds);
-		rprintf("Turtle$ ");
-		if (ConsoleReadline(buf, sizeof(buf), true, timeout_ms) == NULL) {
-			cmdLoop = false;
-			break;
-		}
-		switch(buf[0]) {
-			case 'p':
-			case 'P':
-#ifdef FEATURE_NVPROPERTYEDITOR
-				NVPropertyEditor();
-#endif
-			break;
-			case 't':
-			case 'T':
-#ifdef FEATURE_LORA_PING_PONG
-    			SX1276PingPong();	// basic LoRa raw ping/pong without RadioShuttle
-#endif
-				break;
-#ifdef FEATURE_RADIOTESTSAMPLE
-			case 'x':
-			case 'X':
-				RadioContinuesTX();
-#endif
-				break;
-			case 'r':
-			case 'R':
-				MCUReset();
-				break;
-			case 'd':
-			case 'D':
-				{
-					char *addr = strchr(buf, ' ');
-					if (addr) {
-						*addr++ = 0;
-						char *length = strchr(addr, ' ');
-						if (length) {
-							*length++ = 0;
-						}
-						unsigned long address = strtoll(addr, NULL, 0);
-						unsigned long cnt = 32;
-						if (length)
-							cnt = strtoll(length, NULL, 0);
-						dump("Hexdump", (void *)address, cnt);
-					}
-				}
-				break;
-			case 'c':
-			case 'C':
-				cmdLoop = false;
-				break;
-			default:
-				break;
-		}
-	}
-	rprintf("\r\n");
-
-}