72 Commits

Author SHA1 Message Date
NonPIayerCharacter
ec56008600 build old ir on non-beken (#1979)
* build old ir on non-beken

* fix potential issue

* final fixes
2026-02-09 23:50:51 +01:00
NonPIayerCharacter
ca2b1d7172 Fix LN8825 release (#1978) 2026-02-06 23:30:37 +01:00
NonPIayerCharacter
3b485ee997 HW Timer HAL (#1975)
* HW Timer HAL

* fixes

* more fixes

* extra platforms

* extra

* ameba1/z cpp

* w800 ir

* esp timers

* use hal for ir and rc
2026-02-06 22:03:41 +01:00
NonPIayerCharacter
ac925a6a12 BK use easyflash for flash vars (#1969)
* bk use easyflash for flash vars

* fix?

* Disable EF asserts and log

* test

* w600 fv

* no longer needed
2026-02-06 01:25:13 +01:00
NonPIayerCharacter
e500ac88b4 LTR-303 driver (#1970)
* LTR-303 driver

* Forgot discovery

---------

Co-authored-by: openshwprojects <85486843+openshwprojects@users.noreply.github.com>
2026-02-03 20:40:59 +01:00
NonPIayerCharacter
aeafcb0863 LN882H ADC (#1963)
* LN882H ADC

* Unify 882H and 8825 main. 8825 adc

* fix

* disable adc reinit on 8825

* allow log port change, basic uart, disable berry

* Use UART2 instead of UART0, and allow changing UART pins

* fix

* tr6260 pwm duty 0

* import from tuya

---------

Co-authored-by: openshwprojects <85486843+openshwprojects@users.noreply.github.com>
2026-02-03 20:39:26 +01:00
NonPIayerCharacter
abcf19a498 W600/W800 SPI DMA (#1964) 2026-02-03 20:37:14 +01:00
Tester23
c962d12c74 add drv_dmx512 to makefile 2026-02-01 12:04:45 +01:00
openshwprojects
43e3540518 SSD1306 tiny I2C display driver
* TEST

* t1

* faster

* Update drv_ssd1306.c

* mk

* Update drv_ssd1306.c

* test

* Update drv_ssd1306.c

* Update drv_ssd1306.c

* Update drv_ssd1306.c

* fx

* test

* Update drv_ssd1306.c

* cmds

* fx

* q

* goto

* Update drv_ssd1306.c

* finish

* rev
2026-01-29 01:12:04 +01:00
NonPIayerCharacter
17dbe1e44b ESP8266 changes + LN882H sdk update (#1955) 2026-01-26 10:03:21 +01:00
NonPIayerCharacter
eee7ac2f8e LN8825B (#1946)
* LN8825B

* update

* powersave

* pwm fix

* pwm/ir

* release
2026-01-20 01:13:10 +01:00
NonPIayerCharacter
7fcfe795e4 Extra power save feature (#1943)
* extra power save feature

* update

* fix w800 powersave
2026-01-15 09:55:26 +01:00
MaxineMuster
54d5ae7e16 Driver for NEO6M GPS module (#1890)
* Driver vor NEO6m GPS receiver
Tested on W800

* Some tweaks:
empty RX buffer betewwn readings
on several unsuccessful reads, try enabling the NMEA RMC messages again

* empty buffer every second
remove commented out old code

* fix broken log if no lat/long NS or EW is present

* Add "savecfg" argument to save config to NEO after configuring - so next time we might use it without sending commands to NEO module
this way, only NEOs Tx is needed (and OpenBekens Rx)

---------

Co-authored-by: openshwprojects <85486843+openshwprojects@users.noreply.github.com>
2025-12-21 12:30:01 +01:00
openshwprojects
ee25464c26 RF driver (receiver RF directly with SYN590R or similar)
* test

* T

* T

* W

* Update RCSwitch.cpp

* t

* w

* Update RCSwitch.h

* Update RCSwitch.cpp

* w

* ww

* Update RCSwitch.cpp

* t

* ttt

* test

* dbg

* Update RCSwitch.cpp

* Update RCSwitch.cpp

* ww

* Update drv_rc.cpp

* c

* Update RCSwitch.h

* make

* fix

* Update drv_rc.cpp

* wwww

* wwwwwwwwwww

* Update drv_rc.cpp

* fix

* dsfsdsd

* IOR_RCRecv

* Update RCSwitch.cpp

* test

* ffffffffffffx

* sds

* try

* fx

* tttttttt

* fixes

* fx

* hold

* hide debug vars
2025-12-15 19:56:10 +01:00
divadiow
c166966e02 OpenRTL8710B CloudCutter UG image + release (#1882)
* Realtek RTL8710B CloudCutter Try #1

* rename tool

* .img

* Update workflow.yaml
2025-12-05 00:08:59 +01:00
MaxineMuster
a34f90bcbb DS3231 RTC driver embedded in "local clock" (PR#1729) (#1792)
* Try NTP split update to actual source

* fix windows makefiles and timed_events

* fix typo

* Fix sprintf format

* sprintf format - next try to fix for ESP and ESP8266

* sprintf - special case for ESP8266

* Adding GUI button to set clock

* fix

* Add debug output

* fix missing HTTP output
use original obk_config.h - only renaming functions - to see filesizes

* limit functions to NTP ode CLOCK present

* try fix selftests

* Enable simple clock for all platforms, even if NTP is not enabled

* test fixing merge-conflict

* try fixing merge conflicts #1

* try fix merge conflict

* Fix typos
consolidate time display on main page
fix double comments preventing several documentation details ($mday, $month ...) on docs/constants.md
enabling more time stuff for W800 for local testing.

* Fix setDST argument passing

* only test DST if clock is running

* Fix setting epoch time - use atol(<string arg>) instead of Tokenizer_GetArgInteger(0) for epoch
Change user_main.c to use xticks as uptime for g_secondsElapsed

* Fix g_secondsElapesd for Windows - no xTicks there so stick to old way with g_secondsElapesd++ here ...

* Fix simulator build
remove additional defines for W800 used for testing

* Use esp_timer_get_time() instead of xTicks for ESP.
Seems much better, 30 seconds difference in one day
(used to be over 10 minutes off in 12 hours)

* Include DS3231 code

* Include DS3231 RTC driver

* Try simple fix for TXW81X without RTOS

* Second try fix TXW81X

* Fix comments for doc

* fix obk_config (still using "#define ENABLE_NTP_SUNRISE_SUNSET" instead of new "#define ENABLE_CLOCK_SUNRISE_SUNSET")
fix RDA5981
(as already done in branch Split_NTP_new)

* fix deviceclock code for corrected #define

* enable DS3231 driver for all platforms to test compilation and compare sizes

* fix selftest DST and sunrise/sunset (command names are "CLOCK_..." not "NTP...")

* Fix selftest for DST and sunset/sunrise events

* Add debug to try fixing selftest issue

* more debug

* Disable bedug output after fix.

* Disable DS3231 for all platforms. To tes, use previous commit

* Fix comments and handling of year when setting time of DS3231
Switch to internal time functions to reduce flash usage (avoid gmtime and mktime)

* Fix direct acces of NTP-time via g_ntpTime - use function "Clock_GetCurrentTime()"
switch to obktime instead of time.h "gmtime"

* Fix missing include for deviceclock and obktime

* made ds3231 driver dependent on "#define ENABLE_DRIVER_DS3231"
change "deviceclock.c" to set DS3231 RTC on every clock set command if driver is running, so e.g. every NTP update will also adjust RTC time

* fix missing includes for DRV_IsRunning() and DS3231_SetEpoch()

* introducing DS3231_informClockWasSet(bool force) - called by drv_deviceclock whenever clock is set.
so DS3231 driver can ste the clock, if needed - using "force" will force setting (no supprise ;-))

* Fixes to drv_main.c (missing args for onHassDiscovery)
Fixed missing arg "bPreState" in XX_AppendInformationToHTTPIndexPage()
Changed name from CLOCK to TIME
changed some "gmtime" to obktime "calculateComponents()a

* fixes

* fix obk_config.h

* fix missing include

* fix include for drv_txw81x_camera.c

* Directly call TIME "driver" functions, but don't use as real driver - so hiding it's presence in GUI

* fix missing OnEverySecond for TIME

* Prepare for merge: disable DS3231 driver for all platforms

* fix broken obk_config.h

* revert unintended change of src/driver/drv_max72xx_single.c
2025-12-04 14:46:51 +01:00
NonPIayerCharacter
35fca72376 esp8266 optimize + idle hooks (#1869) 2025-11-23 14:47:39 +01:00
openshwprojects
e9e20ed445 esp8266 ADC, EEPROM driver, max7219 simulator
* test

* Update workflow.yaml

* t

* makes

* Update drv_simpleEEPROM.c

* Update drv_simpleEEPROM.c

* ber

* Update workflow.yaml

* tt

* ber

* charts

* owm

* tt

* rem charts

* smaller

* test

* test

* fixes

* test

* charts

* comments

* test

* tt

* test

* add file to proj

* try to add pin 13 as ADC (testing in progress)

* test

* test

* MAX7219 simulator HACK

* final fixes

* Update drv_max72xx_internal.c

* restore

* fx
2025-11-23 14:01:04 +01:00
Rodion7777
2086cb84fc Implementation of girier MCU driver for 2ch dimmer (#1846)
* Implementation of girier MCU driver for 2ch dimmer

* Fixed review notices

* makefiles

* dpType = 0; // TODO - uninitialized

* header

* add to vcproj

* header

* #if ENABLE_DRIVER_GIRIERMCU

* clear

---------

Co-authored-by: Tester <85486843+openshwprojects@users.noreply.github.com>
2025-11-18 22:00:19 +01:00
openshwprojects
f2c87bf690 merge max72xx clock progress and i2c pinwide scanner and misc fixes
* MAX72XX

* better

* faster buof

* eext

* test

* fx

* fxes

* tr

* fx

* Update drv_max72xx_clock.c

* fxes

* test

* fxes

* tests fxes

* fxes

* scr

* fx

* Update drv_local.h

* show

* Update drv_max72xx_clock.c

* test

* Delete lastEnumTemplate.txt

* TEST

* scan

* Update drv_main.c

* Update obk_main.cmake

* Update drv_multiPinI2CScanner.c

* dbg

* fxes

* Update drv_multiPinI2CScanner.c

* Update drv_multiPinI2CScanner.c

* Update drv_multiPinI2CScanner.c

* owm

* osm test

* restorew platfotms

* Update selftest_openWeatherMap.c

* test

* getter

* Update obk_config.h
2025-11-11 16:27:13 +01:00
openshwprojects
73bbc45126 merge partition search driver (disabled by default)
* test

* search

* fx

* fx1

* enavble

* Update obk_main.mk

* 0x200000

* Update drv_bkPartitions.c

* chk

* crc

* finalize

* fxes
2025-11-04 20:29:54 +01:00
NonPIayerCharacter
f5a3b2642b RTL new fix OTA (#1836)
* RTL new fix OTA
clean-up workflow

* fix esp cache?
2025-10-17 08:44:13 +02:00
KC Stonacek
4ad9a85a08 Add ChType_Enum and enable SetChannelEnum. (#1830)
* create a ChType_Enum to go with SetChannelEnum

* resolve build errors for ChType_Enum PR

* fixing build errors for simulator and others for cmd_enums.c

* added ChType_ReadOnlyEnum and assocaited enum selftests

* ChType_Enum simulation and memory error corrections

* ChType_Enum documentation updates

---------

Co-authored-by: root <root@stonacek.nz>
2025-10-14 09:21:18 +02:00
Nizam Moidu
4a2ae013ed HLW8112 Driver for energy measurments (#1810)
* initial test driver for hlw8112

Signed-off-by: Nizam <code@maxters.net>

* restrict build to BK7231N
will stub other platforms later

Signed-off-by: Nizam <code@maxters.net>

* fix newer gcc build

Signed-off-by: Nizam <code@maxters.net>

* fix channel b stat restore
after all i still doesnt get pointer arithmetic

Signed-off-by: Nizam <code@maxters.net>

* clean up flashvar bk7231 still use emetering struct to store data

Signed-off-by: Nizam <code@maxters.net>

* fix OpenBK7231N_ALT build fail

Signed-off-by: Nizam <code@maxters.net>

* disable incomplete spi device raw access commands and ui

Signed-off-by: Nizam <code@maxters.net>

* remove mqtt hack for commands. leverage existing tasmota command framework

Signed-off-by: Nizam <code@maxters.net>

* missed flashvar restore

Signed-off-by: Nizam <code@maxters.net>

* disable hlw812 driver for upstream pr

Signed-off-by: Nizam <code@maxters.net>

---------

Signed-off-by: Nizam <code@maxters.net>
2025-09-30 15:04:15 +02:00
NonPIayerCharacter
6083ddfca5 RDA5981 (#1813) 2025-09-29 08:41:36 +02:00
openshwprojects
481cc0ede2 DMX works on ESP32 LilyGO, other platforms requires porting code to change baudrate
* ENABLE DMX on ESP

* test

* s

* Update hal_uart_espidf.c

* Update obk_main.cmake

* w

* test

* Update hal_uart_espidf.c

* Update drv_dmx512.c

* test

* test

* test

* w

* t

* c

* t

* test

* T

* Update drv_dmx512.c

* test

* test

* try flush

* try wait

* ticks w

* t

* fx

* 100 ms

* SIM fx

* Update cmd_newLEDDriver.c

* test 2x

* tests

* fixes

* free

* fix

* misc

* b

* hal

* s

* Update workflow.yaml

* pin

* fin

* test

* Update hal_uart_espidf.c
2025-09-14 21:07:24 +02:00
NonPIayerCharacter
e85b9a67be small update (#1786) 2025-09-05 08:58:42 +02:00
NonPIayerCharacter
0d007112b1 TXW817 support (#1779)
* txw81x base no makefile

* txw81x

* gpio fix?

* non-working ota

* mic
2025-09-03 11:46:06 +02:00
NonPIayerCharacter
948237869f LN882H IR (#1783) 2025-09-03 11:45:24 +02:00
NonPIayerCharacter
f3d3ff412a BL602 irRemoteESP (#1777) 2025-08-30 21:24:04 +02:00
openshwprojects
670798a83a merge LED strip backend separation before DMX support
* stub

* clear

* clear upo

* one more test

* split

* fx

* Update drv_led_shared.c

* step

* split

* Update drv_leds_shared.c

* Update selftest_ws2812b.c

* port

* dmx

* DMX

* s

* with test

* fix

* fx

* ChType_Ph test and RGBW test

* ddp formats unfinished

* Update selftest_ws2812b.c

* Update selftest_hass_discovery_ext.c

* fxes
2025-08-28 21:52:59 +02:00
openshwprojects
e6dbea6007 simple TCA9554 driver, enabled by default on 4MB ESP32, for Waveshare barrd
* TCA9554

* fx

* proj

* makeff

* io

* better

* fx

* TCA9554 almoisy

* test

* fx
2025-08-22 09:07:28 +02:00
divadiow
e5b1b864fa spellings (#1767) 2025-08-19 08:50:37 +02:00
NonPIayerCharacter
9adcd9950f Realtek/BL602 spi led (#1763)
* realtek spi led

* fix RTL_A and RTL_B

* fix esp version

* Update docs
add missing esp8266 pins

* bl602 spi led

* fix

* deinit

* bl602 miso swap
2025-08-18 20:37:18 +02:00
openshwprojects
36218fd38e ota cosmetic (#1762)
* step 1

* Update obk_main.mk

* Update OpenBeken.mk

* Update obk_main.cmake

* Update hal_ota_bk7231.c

* Update hal_ota_bk7231.c

* m

* split

* guards

* Update hal_ota_bl602.c

* Update hal_ota_bl602.c

* bk

* better

* header

* w

* TMP

* tttttttt

* Update rest_interface.c

* hal_ota is xradio header....

* undoi

* header

* move

* xradio

* read

* fx

* t

* makefile

* move out xradi o read

* fx

* move out esp

* move out bl602

* move out beken, ln

* move out w8

* ecr tr

* realtek

* Update rest_interface.c

* win

* forgot

* tr6260 split

* Update hal_ota_tr6260.c

* rename ota_progress

* use OTA_GetProgress on all paltforms

* fx

* not needed header

* call OTA_IncrementProgress on OTA so we at laest know that something is happening
2025-08-16 16:04:57 +02:00
NonPIayerCharacter
a1501c00c4 RTL8721DA (AmebaDplus) and RTL8720E (AmebaLite) (#1718)
* amebadplus

* fix + amebalite

* ota, lfs, fast connect fix

* Fix TCP_MSL and hostname

* Readme and releaserc
fix esp irq

* small fixes

* setting mac on amebad/1

* ameba ir

* win ef

* update sdk & disable rtl8720e rest ota

* fix
2025-08-12 17:28:36 +02:00
NonPIayerCharacter
b8965817f6 bl602 deep sleep & ecr sdk update (#1743)
* bl602 deep sleep & ecr sdk update

* esp8266 disable wpa3

* platforms.md
2025-08-10 17:08:33 +02:00
NonPIayerCharacter
94812a2587 BK7231T/U/ESP32/LN882H SPI LED (#1749)
* BK7231U/T_ALT SPI LED

* esp32 spi led dma

* ln882h led spi dma

* simplify

---------

Co-authored-by: Tester23 <85486843+openshwprojects@users.noreply.github.com>
2025-08-10 14:46:01 +02:00
openshwprojects
d34ef02b54 enable irRemoteESP8266 variant on BK7238 - it seems to receive something, but original IR works better for RC6, I didn't test anything more
* try irRemoteESP bk7238

* add IRremoteESP8266
2025-08-09 23:40:20 +02:00
NonPIayerCharacter
5e363ab42f ln882h update sdk (#1724)
* ln882h update sdk

* Disable test commands
2025-08-09 11:49:03 +02:00
NonPIayerCharacter
61d035f616 bk new spi & spidma (#1745)
* bk new spi & spidma

* long app version fix

* esp fix
2025-08-03 11:01:31 +02:00
NonPIayerCharacter
728066de76 esp8266 dout mode by default (#1713)
* esp8266 dout mode by default
enable float printf

* irq fix

* timer stack
2025-07-19 19:18:38 +02:00
MaxineMuster
1c7cdd4881 Ds1820 simple+full as separate drivers (#1705)
* Seperate simple and full driver, introduce "common" for shared code

* Fix command prefixes

* Generate command as multiline if requested

* Fix JS linebreak

* Only use simple dirver - check sizes of firmware images

* Update obk_config.h - enable Full driver for all platforms to allow testing

* Change parsing sttring to device address to allow compact form
Change obk_config.h: remove extra entry for W800, add "FULL" driver to windows build

* fix windows code for "fake" DS18B20

* fix missing files in openBeken_win32_mvsc2017.vcxproj

* fix handle missing task.h for windows

* change Windows emulation to MAX/2 fake sensors

* try fix BL602

* change "fake temperature" of sensors in windows

* change windows sensor temperature once more

* shorten commands by alias

* fix escaping linebreak

* Fix broken JS code ...

* Fix ESP32 is crashing if interrupts are disabled during OWReset for > 480us

* Change output for unused channels
Test if DS1820 channels are in use

* fix warning/error for channel (<=64) printed into a char[5] value

* removeunuses quotes for address

* Fix language

* Capial "S" in Menu entry "Sensors"

* restore obk_config - #define ENABLE_DRIVER_DS1820_FULLonly for WINDOWS and SENSORS variant
2025-07-19 08:03:46 +02:00
NonPIayerCharacter
a261a71ab1 Update ESP-IDF to v5.5-beta1 and add minimal ESP8266 support (#1707)
* update esp-idf

* esp8266

* fix

* pwm, uart and wifi fix

* fix ota

* fix 1m and ps

* update workflow
2025-07-06 07:54:23 +02:00
NonPIayerCharacter
3b99b17cc2 Xradios (#1695)
* Xradios

* deep sleep

* xr806

* small adjustments
2025-06-30 18:47:47 +02:00
NonPIayerCharacter
af37e093d0 bk7231u/bk7231s/bk7252/bk7252n/bk7231t alt. (#1680)
* bk7231u/bk7231t/bk7252 new sdk

* 7252n
2025-06-24 13:16:27 +02:00
NonPIayerCharacter
fac2cf081c w800 + berry (#1629)
* w800 + berry

* fix w600

* Update XR and makefile

* Berry cmake

* BL602 lfs test

* Update w800

* Fix

* W600 heap

* sensors & bl602

* bl602 delay_us
2025-06-20 09:35:00 +02:00
Bartosz Nitka
0ae3f861af Run linux tests with UBSAN (#1664)
Undefined Behavior Sanitizer (UBSAN) [1] is a similar tool to ASAN,
useful for catching bugs related to undefined behavior.

All the problems it detects seem related to the bitshifts related to
flags. Here's a sample:

```
src/new_pins.c:2437:8: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
	#0 0x55a1b51011c1 in PIN_get_Relay_PWM_Count src/new_pins.c:2437
	#1 0x55a1b500389b in NewLED_InitCommands src/cmnds/cmd_newLEDDriver.c:1627
	#2 0x55a1b5150208 in Main_Init_BeforeDelay_Unsafe src/user_main.c:1151
	#3 0x55a1b51506e7 in Main_Init_Before_Delay src/user_main.c:1290
	#4 0x55a1b5150a05 in Main_Init src/user_main.c:1428
	#5 0x55a1b515902c in SIM_ClearOBK src/win_main.c:166
	#6 0x55a1b515a0fd in main src/win_main.c:534
	#7 0x7f1acfdabd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
	#8 0x7f1acfdabe3f in __libc_start_main_impl ../csu/libc-start.c:392
	#9 0x55a1b4fd8eb4 in _start (/home/niteria/tmp/broken-realloc/OpenBK7231T_App/build/win_main+0x10ceb4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/new_pins.c:2437:8 in
```

```
src/new_cfg.c:591:9: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
	#0 0x5629450eb803 in CFG_HasFlag src/new_cfg.c:591
	#1 0x562944ffdb53 in CMD_Init_Early src/cmnds/cmd_main.c:1007
	#2 0x562945153230 in Main_Init_BeforeDelay_Unsafe src/user_main.c:1162
	#3 0x5629451536e7 in Main_Init_Before_Delay src/user_main.c:1290
	#4 0x562945153a05 in Main_Init src/user_main.c:1428
	#5 0x56294515c02c in SIM_ClearOBK src/win_main.c:166
	#6 0x56294515d0fd in main src/win_main.c:534
	#7 0x7f9f5e12bd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
	#8 0x7f9f5e12be3f in __libc_start_main_impl ../csu/libc-start.c:392
	#9 0x562944fdbeb4 in _start (/home/niteria/tmp/broken-realloc/OpenBK7231T_App/build/win_main+0x10ceb4)
```

```
src/httpserver/http_fns.c:369:8: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
	#0 0x560135601d44 in http_fn_index src/httpserver/http_fns.c:369
	#1 0x5601356185cb in HTTP_ProcessPacket src/httpserver/new_http.c:826
	#2 0x5601356a1e93 in Test_FakeHTTPClientPacket_Generic src/selftest/selftest_http.c:86
	#3 0x5601356a2002 in Test_FakeHTTPClientPacket_GET src/selftest/selftest_http.c:102
	#4 0x5601356b773f in Test_PIR src/selftest/selftest_pir.c:27
	#5 0x5601356d204b in Win_DoUnitTests src/win_main.c:171
	#6 0x5601356d3116 in main src/win_main.c:538
	#7 0x7f6911b2ad8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
	#8 0x7f6911b2ae3f in __libc_start_main_impl ../csu/libc-start.c:392
	#9 0x560135551eb4 in _start (/home/niteria/tmp/broken-realloc/OpenBK7231T_App/build/win_main+0x10ceb4)
```

Preexisting problems are suppressed in `platforms/linux/ubsan.suppressions`

[1] https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
2025-06-18 22:52:22 +02:00
openshwprojects
1e201d6be4 fix mem leaks in sim (#1665)
* Update drv_spiLED.c

* Update drv_spiLED.c

* Update drv_spiLED.c

* Update asan.suppressions

* Update drv_spiLED.c

* try

* mcu clear

* return cmd

* free alias leak
2025-06-01 10:06:09 +02:00
Bartosz Nitka
92ea9cd8ab Ability to run linux tests with AddressSanitizer (#1651)
* Ability to run linux tests with AddressSanitizer

This makes it possible to compile and run the tests with Address
Sanitizer (ASAN) [1].

The command is:
```
make -f custom.mk clean; ASAN=1 make -f custom.mk && ./build/win_main -runUnitTests 2
```

Building without ASAN works without change.

Address Sanitizer saves a lot of time debugging memory issues, for
example for a bug where we index in an array with negative index it
gives this nice error message:
```
=================================================================
==2532658==ERROR: AddressSanitizer: global-buffer-overflow on address 0x5642389c5e37 at pc 0x564237e67492 bp 0x7fff17726e50 sp 0x7fff17726e40
READ of size 1 at 0x5642389c5e37 thread T0
    #0 0x564237e67491 in CHANNEL_GetType src/new_cfg.c:427
    #1 0x564237dfc933 in TuyaMCU_ApplyMapping src/driver/drv_tuyaMCU.c:1126
    #2 0x564237dff92f in TuyaMCU_ParseStateMessage src/driver/drv_tuyaMCU.c:1632
    #3 0x564237e019fa in TuyaMCU_ProcessIncoming src/driver/drv_tuyaMCU.c:1977
    #4 0x564237e027ee in TuyaMCU_RunReceive src/driver/drv_tuyaMCU.c:2178
    #5 0x564237e02dc2 in TuyaMCU_RunFrame src/driver/drv_tuyaMCU.c:2335
    #6 0x564237dd2ce6 in DRV_RunQuickTick src/driver/drv_main.c:536
    #7 0x564237ec4037 in QuickTick src/user_main.c:946
    #8 0x564237eca8a5 in Sim_RunFrame src/win_main.c:106
    #9 0x564237eca993 in Sim_RunFrames src/win_main.c:134
    #10 0x564237ebce4a in Test_TuyaMCU_Basic src/selftest/selftest_tuyaMCU.c:369
    #11 0x564237ecab1f in Win_DoUnitTests src/win_main.c:194
    #12 0x564237ecba57 in main src/win_main.c:535
    #13 0x7fb55312ed8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #14 0x7fb55312ee3f in __libc_start_main_impl ../csu/libc-start.c:392
    #15 0x564237cb16b4 in _start (/home/niteria/tmp/broken-realloc/OpenBK7231T_App/build/win_main+0xcf6b4)

0x5642389c5e37 is located 51 bytes to the right of global variable 'stat_deduper_culled_tooFast' defined in 'src/mqtt/new_mqtt_deduper.c:40:12' (0x5642389c5e00) of size 4
0x5642389c5e37 is located 9 bytes to the left of global variable 'g_mutex' defined in 'src/mqtt/new_mqtt_deduper.c:42:26' (0x5642389c5e40) of size 4
SUMMARY: AddressSanitizer: global-buffer-overflow src/new_cfg.c:427 in CHANNEL_GetType
Shadow bytes around the buggy address:
  0x0ac8c7130b70: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ac8c7130b80: 00 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ac8c7130b90: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ac8c7130ba0: 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9
  0x0ac8c7130bb0: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
=>0x0ac8c7130bc0: 04 f9 f9 f9 f9 f9[f9]f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ac8c7130bd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ac8c7130be0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ac8c7130bf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ac8c7130c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ac8c7130c10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==2532658==ABORTING
```

[1] https://github.com/google/sanitizers/wiki/addresssanitizer

* disable tests broken on linux

* add a suppression file for known leaks

* attempt at adding an ASAN workflow

* fix autogen

* Update workflow.yaml

---------

Co-authored-by: openshwprojects <85486843+openshwprojects@users.noreply.github.com>
2025-05-31 14:27:02 +02:00