diff --git a/build/arm-tools.mk b/build/arm-tools.mk
index 22cd57845d..5d449ab856 100644
--- a/build/arm-tools.mk
+++ b/build/arm-tools.mk
@@ -68,10 +68,9 @@ endif
CFLAGS += --specs=nano.specs
# Check if the compiler version is the minimum required
-version_to_number=$(shell v=$1; v=($${v//./ }); echo $$((v[0] * 10000 + v[1] * 100 + v[2])))
-get_major_version=$(shell v=$1; v=($${v//./ }); echo $${v[0]})
-arm_gcc_version_str:=$(shell $(CC) -dumpversion)
-arm_gcc_version:=$(call version_to_number,$(arm_gcc_version_str))
+include $(COMMON_BUILD)/gcc-version.mk
+arm_gcc_version_str:=$(gcc_version_str)
+arm_gcc_version:=$(gcc_version)
expected_version_str:=10.2.1
ifeq ($(shell test $(arm_gcc_version) -lt $(call version_to_number,$(expected_version_str)); echo $$?),0)
$(error "ARM gcc version $(expected_version_str) or later required, but found $(arm_gcc_version_str)")
diff --git a/build/gcc-tools.mk b/build/gcc-tools.mk
index f670d64e01..26d2733d51 100644
--- a/build/gcc-tools.mk
+++ b/build/gcc-tools.mk
@@ -31,5 +31,9 @@ CFLAGS += -Wno-return-type-c-linkage
CPPFLAGS += -Wno-unused-private-field
endif
+ifeq ($(BUILD_STANDALONE_LIB),y)
+CFLAGS += -fPIC -fpic -rdynamic -fno-plt
+LDFLAGS += -fPIC -fpic -rdynamic -fno-plt
+endif
-
+include $(COMMON_BUILD)/gcc-version.mk
diff --git a/build/gcc-version.mk b/build/gcc-version.mk
new file mode 100644
index 0000000000..bb28deca7b
--- /dev/null
+++ b/build/gcc-version.mk
@@ -0,0 +1,4 @@
+version_to_number=$(shell v=$1; v=($${v//./ }); echo $$((v[0] * 10000 + v[1] * 100 + v[2])))
+get_major_version=$(shell v=$1; v=($${v//./ }); echo $${v[0]})
+gcc_version_str:=$(shell $(CC) -dumpfullversion)
+gcc_version:=$(call version_to_number,$(arm_gcc_version_str))
diff --git a/build/module-defaults.mk b/build/module-defaults.mk
index 4c4b365525..56d0bbcdd9 100644
--- a/build/module-defaults.mk
+++ b/build/module-defaults.mk
@@ -4,6 +4,8 @@ START_DFU_FLASHER_SERIAL_SPEED=14400
START_YMODEM_FLASHER_SERIAL_SPEED=28800
include $(COMMON_BUILD)/version.mk
+include $(COMMON_BUILD)/os.mk
+include $(COMMON_BUILD)/gcc-version.mk
QUOTE='
@@ -61,9 +63,12 @@ CFLAGS += -Wno-error=type-limits
CFLAGS += -fno-strict-aliasing
CFLAGS += -DSPARK=1 -DPARTICLE=1
CFLAGS += -Werror=return-type
-
CFLAGS += -Wundef
+ifeq ($(shell test $(gcc_version) -lt $(call version_to_number,"11.0.0"); echo $$?),0)
+CFLAGS += -Wno-error=cast-function-type
+endif
+
ifdef START_DFU_FLASHER_SERIAL_SPEED
CFLAGS += -DSTART_DFU_FLASHER_SERIAL_SPEED=$(START_DFU_FLASHER_SERIAL_SPEED)
endif
@@ -76,6 +81,10 @@ CONLYFLAGS += -Wno-pointer-sign
LDFLAGS += $(LIBS_EXT)
LDFLAGS += $(patsubst %,-L%,$(LIB_DIRS))
+ifeq ($(BUILD_STANDALONE_LIB),y)
+CFLAGS += -DPARTICLE_BUILD_STANDALONE_LIB
+endif
+
ifeq ($(PLATFORM_ID),6)
CFLAGS += -DBOOTLOADER_SDK_3_3_0_PARTICLE -DPARTICLE_DCT_COMPATIBILITY
endif
@@ -115,7 +124,7 @@ LTO_EXT = -lto
CFLAGS += -DPARTICLE_COMPILE_LTO
endif
-ifeq ("$(TARGET_TYPE)","a")
+ifneq (,$(filter $(TARGET_TYPE),a so))
TARGET_FILE_PREFIX = lib
endif
@@ -134,4 +143,11 @@ BUILD_PATH ?= $(BUILD_PATH_BASE)/$(MODULE)$(and $(BUILD_PATH_EXT),/$(BUILD_PATH_
BUILD_TARGET_PLATFORM = platform-$(PLATFORM_ID)$(MODULAR_EXT)$(LTO_EXT)
BUILD_PATH_EXT ?= $(BUILD_TARGET_PLATFORM)
-EXECUTABLE_EXTENSION=
\ No newline at end of file
+EXECUTABLE_EXTENSION=
+ifeq ($(MAKE_OS),WINDOWS)
+SHARED_LIBRARY_EXTENSION ?= .dll
+else ifeq ($(MAKE_OS),LINUX)
+SHARED_LIBRARY_EXTENSION ?= .so
+else ifeq ($(MAKE_OS),OSX)
+SHARED_LIBRARY_EXTENSION ?= .dylib
+endif
diff --git a/build/module.mk b/build/module.mk
index 940fcbea0e..3117a18b43 100644
--- a/build/module.mk
+++ b/build/module.mk
@@ -99,6 +99,8 @@ hex: $(TARGET_BASE).hex
lst: $(TARGET_BASE).lst
exe: $(TARGET_BASE)$(EXECUTABLE_EXTENSION)
@echo Built x-compile executable at $(TARGET_BASE)$(EXECUTABLE_EXTENSION)
+so: $(TARGET_BASE)$(SHARED_LIBRARY_EXTENSION)
+ @echo Built shared library at $(TARGET_BASE)$(SHARED_LIBRARY_EXTENSION)
none:
;
@@ -239,6 +241,13 @@ $(TARGET_BASE)$(EXECUTABLE_EXTENSION) : $(ALLOBJ) $(LIB_DEPS) $(LINKER_DEPS)
$(VERBOSE)$(CCACHE) $(CPP) $(CFLAGS) $(ALLOBJ) --output $@ $(LDFLAGS)
$(call echo,)
+$(TARGET_BASE)$(SHARED_LIBRARY_EXTENSION) : $(ALLOBJ) $(LIB_DEPS) $(LINKER_DEPS)
+ $(call echo,'Building target: $@')
+ $(call echo,'Invoking: GCC C++ Linker')
+ $(VERBOSE)$(MKDIR) $(dir $@)
+ $(VERBOSE)$(CCACHE) $(CPP) $(CFLAGS) -shared $(ALLOBJ) --output $@ $(LDFLAGS)
+ $(call echo,)
+
# Tool invocations
$(TARGET_BASE).a : $(ALLOBJ)
diff --git a/hal/src/gcc/include.mk b/hal/src/gcc/include.mk
index 92c4928939..1de6e26349 100644
--- a/hal/src/gcc/include.mk
+++ b/hal/src/gcc/include.mk
@@ -13,7 +13,10 @@ ifneq (,$(findstring hal,$(MAKE_DEPENDENCIES)))
LDFLAGS += -lc
-
+# Building as a standalone static library with default
+# template implementations and no dependency on boost or
+# other external libraries
+ifneq ($(BUILD_STANDALONE_LIB),y)
# additional libraries required by gcc build
ifdef SYSTEMROOT
LIBS += boost_system-mgw48-mt-1_57 ws2_32 wsock32
@@ -23,6 +26,7 @@ endif
LIBS += boost_program_options boost_random boost_thread
LIB_DIRS += $(BOOST_ROOT)/stage/lib
+endif # $(BUILD_STANDALONE_LIB),y
# gcc HAL is different for test driver and test subject
ifeq "$(SPARK_TEST_DRIVER)" "1"
diff --git a/hal/src/gcc/sources.mk b/hal/src/gcc/sources.mk
index 7cbd066659..f2809cb258 100644
--- a/hal/src/gcc/sources.mk
+++ b/hal/src/gcc/sources.mk
@@ -2,8 +2,10 @@ CPPFLAGS += -DBOOST_ASIO_SEPARATE_COMPILATION
# use the boost libraries
$(info "BOOST $(BOOST_ROOT)")
+ifneq ("$(BOOST_ROOT)","")
INCLUDE_DIRS += $(BOOST_ROOT)
INCLUDE_DIRS += $(BOOST_ROOT)/libs/asio/include
+endif
HAL_SRC_TEMPLATE_PATH = $(TARGET_HAL_PATH)/src/template
HAL_SRC_GCC_PATH = $(TARGET_HAL_PATH)/src/gcc
@@ -29,11 +31,16 @@ remove_cpp = $(addsuffix .cpp,$(addprefix $(templatedir)/,$(overrides)))
# remove files from template that have the same basename as an overridden file
# e.g. if template contains core_hal.c, and gcc contains core_hal.cpp, the gcc module
# will override
+ifneq ($(BUILD_STANDALONE_LIB),y)
+# Not using gcc-specific sources if building as a standalone static library
+# with template implementations and no dependency on boost or
+# other external libraries
CSRC := $(filter-out $(remove_c),$(CSRC))
CPPSRC := $(filter-out $(remove_cpp),$(CPPSRC))
CSRC += $(call target_files,$(overridedir)/,*.c)
CPPSRC += $(call target_files,$(overridedir)/,*.cpp)
+endif # ($(BUILD_STANDALONE_LIB),y)
CPPSRC += $(call target_files,$(HAL_MODULE_PATH)/network/util/,*.cpp)
diff --git a/hal/src/template/concurrent_hal.cpp b/hal/src/template/concurrent_hal.cpp
new file mode 100644
index 0000000000..7dbaa45e63
--- /dev/null
+++ b/hal/src/template/concurrent_hal.cpp
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2021 Particle Industries, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see .
+ */
+
+#include "concurrent_hal.h"
+
+os_result_t os_thread_create(os_thread_t* thread, const char* name, os_thread_prio_t priority, os_thread_fn_t fun, void* thread_param, size_t stack_size)
+{
+ return 0;
+}
+
+os_thread_t os_thread_current(void* reserved)
+{
+ return nullptr;
+}
+
+bool os_thread_is_current(os_thread_t thread)
+{
+ return false;
+}
+
+os_result_t os_thread_yield(void)
+{
+ return 0;
+}
+
+bool os_thread_current_within_stack()
+{
+ return true;
+}
+
+os_result_t os_thread_join(os_thread_t thread)
+{
+ return 0;
+}
+
+os_result_t os_thread_exit(os_thread_t thread)
+{
+ return 0;
+}
+
+os_result_t os_thread_cleanup(os_thread_t thread)
+{
+ return 0;
+}
+
+os_result_t os_thread_delay_until(system_tick_t *previousWakeTime, system_tick_t timeIncrement)
+{
+ return 0;
+}
+
+os_thread_notify_t os_thread_wait(system_tick_t ms, void* reserved)
+{
+ return 0;
+}
+
+int os_thread_notify(os_thread_t thread, void* reserved)
+{
+ return 0;
+}
+
+int os_queue_create(os_queue_t* queue, size_t item_size, size_t item_count, void*)
+{
+ return 0;
+}
+
+int os_queue_put(os_queue_t queue, const void* item, system_tick_t delay, void*)
+{
+ return 0;
+}
+
+int os_queue_take(os_queue_t queue, void* item, system_tick_t delay, void*)
+{
+ return 0;
+}
+
+int os_queue_peek(os_queue_t queue, void* item, system_tick_t delay, void*)
+{
+ return 0;
+}
+
+int os_queue_destroy(os_queue_t queue, void*)
+{
+ return 0;
+}
+
+int os_mutex_create(os_mutex_t* mutex)
+{
+ return 0;
+}
+
+int os_mutex_destroy(os_mutex_t mutex)
+{
+ return 0;
+}
+
+int os_mutex_lock(os_mutex_t mutex)
+{
+ return 0;
+}
+
+int os_mutex_trylock(os_mutex_t mutex)
+{
+ return 0;
+}
+
+int os_mutex_unlock(os_mutex_t mutex)
+{
+ return 0;
+}
+
+int os_mutex_recursive_create(os_mutex_recursive_t* mutex)
+{
+ return 0;
+}
+
+int os_mutex_recursive_destroy(os_mutex_recursive_t mutex)
+{
+ return 0;
+}
+
+int os_mutex_recursive_lock(os_mutex_recursive_t mutex)
+{
+ return 0;
+}
+
+int os_mutex_recursive_trylock(os_mutex_recursive_t mutex)
+{
+ return 0;
+}
+
+int os_mutex_recursive_unlock(os_mutex_recursive_t mutex)
+{
+ return 0;
+}
+
+void os_thread_scheduling(bool enabled, void* reserved)
+{
+}
+
+os_scheduler_state_t os_scheduler_get_state(void* reserved)
+{
+ return OS_SCHEDULER_STATE_NOT_STARTED;
+}
+
+int os_semaphore_create(os_semaphore_t* semaphore, unsigned max, unsigned initial)
+{
+ return 0;
+}
+
+int os_semaphore_destroy(os_semaphore_t semaphore)
+{
+ return 0;
+}
+
+int os_semaphore_take(os_semaphore_t semaphore, system_tick_t timeout, bool reserved)
+{
+ return 0;
+}
+
+int os_semaphore_give(os_semaphore_t semaphore, bool reserved)
+{
+ return 0;
+}
+
+/**
+ * Create a new timer. Returns 0 on success.
+ */
+int os_timer_create(os_timer_t* timer, unsigned period, void (*callback)(os_timer_t timer), void* const timer_id, bool one_shot, void* reserved)
+{
+ return 0;
+}
+
+int os_timer_get_id(os_timer_t timer, void** timer_id)
+{
+ return 0;
+}
+
+int os_timer_set_id(os_timer_t timer, void* timer_id)
+{
+ return 0;
+}
+
+int os_timer_change(os_timer_t timer, os_timer_change_t change, bool fromISR, unsigned period, unsigned block, void* reserved)
+{
+ return 0;
+}
+
+int os_timer_destroy(os_timer_t timer, void* reserved)
+{
+ return 0;
+}
+
+int os_timer_is_active(os_timer_t timer, void* reserved)
+{
+ return 0;
+}
+
+void __flash_acquire() {
+}
+
+void __flash_release() {
+}
+
+void periph_lock() {
+}
+
+void periph_unlock() {
+}
diff --git a/hal/src/template/core_hal.cpp b/hal/src/template/core_hal.cpp
index 15c6a632d2..92f3e3c2fc 100644
--- a/hal/src/template/core_hal.cpp
+++ b/hal/src/template/core_hal.cpp
@@ -136,11 +136,12 @@ unsigned HAL_Core_System_Clock(HAL_SystemClock clock, void* reserved)
}
+#ifndef PARTICLE_BUILD_STANDALONE_LIB
int main()
{
while(1);
}
-
+#endif // PARTICLE_BUILD_STANDALONE_LIB
int HAL_Feature_Set(HAL_Feature feature, bool enabled)
{
@@ -192,3 +193,28 @@ void HAL_Set_Event_Callback(HAL_Event_Callback callback, void* reserved) {
void hal_notify_event(int event, int flags, void* data) {
}
+
+int HAL_System_Backup_Save(size_t offset, const void* buffer, size_t length, void* reserved)
+{
+ return -1;
+}
+
+int HAL_System_Backup_Restore(size_t offset, void* buffer, size_t max_length, size_t* length, void* reserved)
+{
+ return -1;
+}
+
+uint32_t HAL_Core_Runtime_Info(runtime_info_t* info, void* reserved)
+{
+ return -1;
+}
+
+void HAL_Core_System_Reset_Ex(int reason, uint32_t data, void *reserved)
+{
+
+}
+
+uint16_t HAL_Bootloader_Get_Flag(BootloaderFlag flag)
+{
+ return 0;
+}
diff --git a/hal/src/template/device_code.cpp b/hal/src/template/device_code.cpp
new file mode 100644
index 0000000000..b74d1b4c8b
--- /dev/null
+++ b/hal/src/template/device_code.cpp
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2021 Particle Industries, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see .
+ */
+
+#include "device_code.h"
+
+bool fetch_or_generate_setup_ssid(device_code_t* code) {
+ return false;
+}
diff --git a/hal/src/template/deviceid_hal.cpp b/hal/src/template/deviceid_hal.cpp
index acac9e58fd..adc97a5721 100644
--- a/hal/src/template/deviceid_hal.cpp
+++ b/hal/src/template/deviceid_hal.cpp
@@ -38,3 +38,8 @@ unsigned HAL_Platform_ID()
{
return PLATFORM_ID;
}
+
+int HAL_Get_Device_Identifier(const char** name, char* buf, size_t buflen, unsigned index, void* reserved)
+{
+ return -1;
+}
diff --git a/hal/src/template/gpio_hal.cpp b/hal/src/template/gpio_hal.cpp
index f67a0d9c01..95ac02972b 100644
--- a/hal/src/template/gpio_hal.cpp
+++ b/hal/src/template/gpio_hal.cpp
@@ -90,3 +90,8 @@ int HAL_Pin_Configure(pin_t pin, const hal_gpio_config_t* conf, void* reserved)
{
return 0;
}
+
+uint32_t HAL_Pulse_In(pin_t pin, uint16_t value)
+{
+ return 0;
+}
diff --git a/hal/src/template/ota_flash_hal.cpp b/hal/src/template/ota_flash_hal.cpp
index d9745fef48..932e65a490 100644
--- a/hal/src/template/ota_flash_hal.cpp
+++ b/hal/src/template/ota_flash_hal.cpp
@@ -105,4 +105,29 @@ uint16_t HAL_Get_Claim_Code(char* buffer, unsigned len)
return 0;
}
+void HAL_OTA_Add_System_Info(hal_system_info_t* info, bool create, void* reserved)
+{
+}
+
+bool HAL_IsDeviceClaimed(void* reserved)
+{
+ return false;
+}
+
+int HAL_FLASH_OTA_Validate(bool userDepsOptional, module_validation_flags_t flags, void* reserved)
+{
+ return 0;
+}
+int HAL_FLASH_ApplyPendingUpdate(bool dryRun, void* reserved)
+{
+ return SYSTEM_ERROR_UNKNOWN;
+}
+
+void HAL_FLASH_Write_ServerAddress(const uint8_t *buf, bool udp)
+{
+}
+
+void HAL_FLASH_Write_ServerPublicKey(const uint8_t *keyBuffer, bool udp)
+{
+}
diff --git a/hal/src/template/rgbled_hal.cpp b/hal/src/template/rgbled_hal.cpp
new file mode 100644
index 0000000000..216e5d6b67
--- /dev/null
+++ b/hal/src/template/rgbled_hal.cpp
@@ -0,0 +1,63 @@
+
+
+#include "rgbled_hal.h"
+
+void Set_RGB_LED_Values(uint16_t r, uint16_t g, uint16_t b)
+{
+
+}
+
+void Get_RGB_LED_Values(uint16_t* rgb)
+{
+
+}
+
+void Set_User_LED(uint8_t state)
+{
+
+}
+
+void Toggle_User_LED(void)
+{
+
+}
+
+uint16_t Get_RGB_LED_Max_Value(void)
+{
+ return 65535;
+}
+
+void HAL_Led_Rgb_Set_Values(uint16_t r, uint16_t g, uint16_t b, void* reserved)
+{
+}
+
+void HAL_Led_Rgb_Get_Values(uint16_t* rgb, void* reserved)
+{
+}
+
+uint32_t HAL_Led_Rgb_Get_Max_Value(void* reserved)
+{
+ return 65535;
+}
+
+void HAL_Led_User_Set(uint8_t state, void* reserved)
+{
+}
+
+void HAL_Led_User_Toggle(void* reserved)
+{
+}
+
+led_config_t* HAL_Led_Set_Configuration(uint8_t led, led_config_t* conf, void* reserved)
+{
+ return nullptr;
+}
+
+led_config_t* HAL_Led_Get_Configuration(uint8_t led, void* reserved)
+{
+ return nullptr;
+}
+
+void HAL_Led_Init(uint8_t led, led_config_t* conf, void* reserved)
+{
+}
diff --git a/hal/src/template/sleep_hal.cpp b/hal/src/template/sleep_hal.cpp
index f4466772c0..0e4548ee75 100644
--- a/hal/src/template/sleep_hal.cpp
+++ b/hal/src/template/sleep_hal.cpp
@@ -21,3 +21,8 @@
int hal_sleep_enter(const hal_sleep_config_t* config, hal_wakeup_source_base_t** wakeup_source, void* reserved) {
return SYSTEM_ERROR_NOT_SUPPORTED;
}
+
+int hal_sleep_validate_config(const hal_sleep_config_t* config, void* reserved) {
+ return 0;
+}
+
diff --git a/hal/src/template/socket_hal.cpp b/hal/src/template/socket_hal.cpp
index b34cd3c78f..09f0836e41 100644
--- a/hal/src/template/socket_hal.cpp
+++ b/hal/src/template/socket_hal.cpp
@@ -132,3 +132,13 @@ sock_result_t socket_peer(sock_handle_t sd, sock_peer_t* peer, void* reserved)
{
return -1;
}
+
+sock_result_t socket_create_tcp_server(uint16_t port, network_interface_t nif)
+{
+ return -1;
+}
+
+sock_result_t socket_receivefrom_ex(sock_handle_t sd, void* buffer, socklen_t len, uint32_t flags, sockaddr_t* address, socklen_t* addr_size, system_tick_t timeout, void* reserved)
+{
+ return -1;
+}
diff --git a/hal/src/template/spi_hal.cpp b/hal/src/template/spi_hal.cpp
index 2b1943bda3..0e4f75a022 100644
--- a/hal/src/template/spi_hal.cpp
+++ b/hal/src/template/spi_hal.cpp
@@ -64,7 +64,7 @@ bool hal_spi_is_enabled(hal_spi_interface_t spi)
return false;
}
-void hal_spi_transfer_dma(hal_spi_interface_t spi, void* tx_buffer, void* rx_buffer, uint32_t length, hal_spi_dma_user_callback userCallback)
+void hal_spi_transfer_dma(hal_spi_interface_t spi, const void* tx_buffer, void* rx_buffer, uint32_t length, hal_spi_dma_user_callback userCallback)
{
}
diff --git a/hal/src/template/system_interrupts.cpp b/hal/src/template/system_interrupts.cpp
new file mode 100644
index 0000000000..f0067f9270
--- /dev/null
+++ b/hal/src/template/system_interrupts.cpp
@@ -0,0 +1,16 @@
+
+#include "interrupts_hal.h"
+
+uint8_t HAL_Set_System_Interrupt_Handler(hal_irq_t irq, const HAL_InterruptCallback* callback, HAL_InterruptCallback* previous, void* reserved)
+{
+ return false;
+}
+
+uint8_t HAL_Get_System_Interrupt_Handler(hal_irq_t irq, HAL_InterruptCallback* callback, void* reserved)
+{
+ return false;
+}
+
+void HAL_System_Interrupt_Trigger(hal_irq_t irq, void* reserved)
+{
+}
diff --git a/hal/src/template/usart_hal.cpp b/hal/src/template/usart_hal.cpp
index 6692af14bf..ed08a2a70d 100644
--- a/hal/src/template/usart_hal.cpp
+++ b/hal/src/template/usart_hal.cpp
@@ -85,3 +85,21 @@ int hal_usart_sleep(hal_usart_interface_t serial, bool sleep, void* reserved)
{
return 0;
}
+
+void hal_usart_begin_config(hal_usart_interface_t serial, uint32_t baud, uint32_t config, void *ptr)
+{
+}
+
+uint32_t hal_usart_write_nine_bits(hal_usart_interface_t serial, uint16_t data)
+{
+ return 0;
+}
+
+uint8_t hal_usart_break_detected(hal_usart_interface_t serial)
+{
+ return 0;
+}
+
+void hal_usart_send_break(hal_usart_interface_t serial, void* reserved)
+{
+}
diff --git a/hal/src/template/wlan_hal.cpp b/hal/src/template/wlan_hal.cpp
index 25f5b846f2..2b93a715b4 100644
--- a/hal/src/template/wlan_hal.cpp
+++ b/hal/src/template/wlan_hal.cpp
@@ -188,3 +188,13 @@ int wlan_set_hostname(const char* hostname, void* reserved)
// Unsupported
return -1;
}
+
+int wlan_select_antenna(WLanSelectAntenna_TypeDef antenna)
+{
+ return 0;
+}
+
+int wlan_get_credentials(wlan_scan_result_t callback, void* callback_data)
+{
+ return -1;
+}
diff --git a/main/makefile b/main/makefile
index c208786d9e..d0c599961d 100644
--- a/main/makefile
+++ b/main/makefile
@@ -87,7 +87,14 @@ LIB_DIRS += $(dir $(LIB_DEPS))
# Target this makefile is building.
ifeq ("$(ARCH)","gcc")
+
+ifneq ($(BUILD_STANDALONE_LIB),y)
TARGET=exe
+else
+TARGET=so
+TARGET_TYPE=so
+endif
+
else
TARGET=elf bin lst hex size
endif
diff --git a/third_party/mbedtls/build.mk b/third_party/mbedtls/build.mk
index 0d475cb797..a2ff38ed8d 100644
--- a/third_party/mbedtls/build.mk
+++ b/third_party/mbedtls/build.mk
@@ -2,3 +2,4 @@ TARGET_MBEDTLS_SRC_PATH = $(MBEDTLS_MODULE_PATH)/mbedtls/library
# C source files included in this build.
CSRC += $(call target_files,$(TARGET_MBEDTLS_SRC_PATH)/,*.c)
+CFLAGS += -Wno-error=array-parameter
\ No newline at end of file
diff --git a/user/applications/device-os/application.cpp b/user/applications/device-os/application.cpp
new file mode 100644
index 0000000000..545382bf2b
--- /dev/null
+++ b/user/applications/device-os/application.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2021 Particle Industries, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see .
+ */
+
+#include "application.h"
+
+__attribute__((weak)) void setup() {
+
+}
+
+__attribute__((weak)) void loop() {
+
+}