Skip to content

Commit

Permalink
TR6260 support (#1446)
Browse files Browse the repository at this point in the history
* TR6260 initial

* fix gh-actions

* various fixes/features

* wifi fast connect fix

* fix gpio, add i2c

* move config to obk
  • Loading branch information
NonPIayerCharacter authored Dec 12, 2024
1 parent 2c0b3cd commit 532a903
Show file tree
Hide file tree
Showing 26 changed files with 1,372 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [OpenBK7231T, OpenBK7231N, OpenXR809, OpenBL602, OpenW800, OpenW600, OpenLN882H]
platform: [OpenBK7231T, OpenBK7231N, OpenXR809, OpenBL602, OpenW800, OpenW600, OpenLN882H, OpenTR6260]
steps:
- name: Source checkout
uses: actions/checkout@v3
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@
path = sdk/esp-idf
url = https://github.com/espressif/esp-idf.git
branch = release/v5.3
[submodule "sdk/OpenTR6260"]
path = sdk/OpenTR6260
url = https://github.com/NonPIayerCharacter/OpenTR6260.git
branch = master
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ sdk/OpenLN882H/project/OpenBeken/app:
@mkdir -p "sdk/OpenLN882H/project/OpenBeken"
ln -s "$(shell pwd)/" "sdk/OpenLN882H/project/OpenBeken/app"

.PHONY: prebuild_OpenBK7231N prebuild_OpenBK7231T prebuild_OpenBL602 prebuild_OpenLN882H prebuild_OpenW600 prebuild_OpenW800 prebuild_OpenXR809 prebuild_ESPIDF
.PHONY: prebuild_OpenBK7231N prebuild_OpenBK7231T prebuild_OpenBL602 prebuild_OpenLN882H
.PHONY: prebuild_OpenW600 prebuild_OpenW800 prebuild_OpenXR809 prebuild_ESPIDF prebuild_OpenTR6260

prebuild_OpenBK7231N:
@if [ -e platforms/BK7231N/pre_build.sh ]; then \
Expand Down Expand Up @@ -132,6 +133,13 @@ prebuild_ESPIDF:
else echo "prebuild for ESP-IDF not found ... "; \
fi

prebuild_OpenTR6260:
@if [ -e platforms/TR6260/pre_build.sh ]; then \
echo "prebuild found for TR6260"; \
sh platforms/TR6260/pre_build.sh; \
else echo "prebuild for TR6260 not found ... "; \
fi

# Build main binaries
OpenBK7231T: prebuild_OpenBK7231T
$(MAKE) APP_NAME=OpenBK7231T TARGET_PLATFORM=bk7231t SDK_PATH=sdk/OpenBK7231T APPS_BUILD_PATH=../bk7231t_os build-BK7231
Expand Down Expand Up @@ -258,6 +266,13 @@ OpenESP32S3: prebuild_ESPIDF
mkdir -p output/$(APP_VERSION)
esptool.py -c esp32s3 merge_bin -o output/$(APP_VERSION)/OpenESP32S3_$(APP_VERSION).factory.bin --flash_mode dio --flash_size 4MB 0x0 ./platforms/ESP-IDF/build-s3/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-s3/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-s3/OpenBeken.bin
cp ./platforms/ESP-IDF/build-s3/OpenBeken.bin output/$(APP_VERSION)/OpenESP32S3_$(APP_VERSION).img

.PHONY: OpenTR6260
OpenTR6260: prebuild_OpenTR6260
if [ ! -e sdk/OpenTR6260/toolchain/nds32le-elf-mculib-v3 ]; then cd sdk/OpenTR6260/toolchain && xz -d < nds32le-elf-mculib-v3.txz | tar xvf - > /dev/null; fi
cd sdk/OpenTR6260/scripts && APP_VERSION=$(APP_VERSION) bash build_tr6260s1.sh
mkdir -p output/$(APP_VERSION)
cp sdk/OpenTR6260/out/tr6260s1/standalone/tr6260s1_0x007000.bin output/$(APP_VERSION)/OpenTR6260_$(APP_VERSION).bin

# clean .o files and output directory
.PHONY: clean
Expand All @@ -268,6 +283,7 @@ clean:
$(MAKE) -C sdk/OpenXR809/project/oxr_sharedApp/gcc clean
$(MAKE) -C sdk/OpenW800 clean
$(MAKE) -C sdk/OpenW600 clean
$(MAKE) -C sdk/OpenTR6260/scripts tr6260s1_clean
test -d ./sdk/OpenLN882H/build && cmake --build ./sdk/OpenLN882H/build --target clean
test -d ./platforms/ESP-IDF/build-32 && cmake --build ./platforms/ESP-IDF/build-32 --target clean
test -d ./platforms/ESP-IDF/build-c3 && cmake --build ./platforms/ESP-IDF/build-c3 --target clean
Expand Down
129 changes: 129 additions & 0 deletions platforms/TR6260/openbeken.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
VPATH += $(OBK_PATH)
DEFINE += -DUSER_SW_VER='"$(APP_VERSION)"'
DEFINE += -DPLATFORM_TR6260

CSRCS += base64/base64.c
CSRCS += bitmessage/bitmessage_read.c
CSRCS += bitmessage/bitmessage_write.c
CSRCS += cJSON/cJSON.c
CSRCS += cmnds/cmd_channels.c
CSRCS += cmnds/cmd_eventHandlers.c
CSRCS += cmnds/cmd_if.c
CSRCS += cmnds/cmd_main.c
CSRCS += cmnds/cmd_newLEDDriver_colors.c
CSRCS += cmnds/cmd_newLEDDriver.c
CSRCS += cmnds/cmd_repeatingEvents.c
CSRCS += cmnds/cmd_script.c
CSRCS += cmnds/cmd_simulatorOnly.c
CSRCS += cmnds/cmd_tasmota.c
CSRCS += cmnds/cmd_tcp.c
CSRCS += cmnds/cmd_test.c
CSRCS += cmnds/cmd_tokenizer.c
CSRCS += devicegroups/deviceGroups_read.c
CSRCS += devicegroups/deviceGroups_util.c
CSRCS += devicegroups/deviceGroups_write.c
CSRCS += driver/drv_main.c
CSRCS += hal/tr6260/hal_adc_tr6260.c
CSRCS += hal/tr6260/hal_flashConfig_tr6260.c
CSRCS += hal/tr6260/hal_flashVars_tr6260.c
CSRCS += hal/tr6260/hal_generic_tr6260.c
CSRCS += hal/tr6260/hal_main_tr6260.c
CSRCS += hal/tr6260/hal_pins_tr6260.c
CSRCS += hal/tr6260/hal_wifi_tr6260.c
CSRCS += httpserver/hass.c
CSRCS += httpserver/http_basic_auth.c
CSRCS += httpserver/http_fns.c
CSRCS += httpserver/http_tcp_server.c
CSRCS += httpserver/new_tcp_server.c
CSRCS += httpserver/json_interface.c
CSRCS += httpserver/new_http.c
CSRCS += httpserver/rest_interface.c
CSRCS += mqtt/new_mqtt_deduper.c
CSRCS += jsmn/jsmn.c
CSRCS += logging/logging.c
CSRCS += mqtt/new_mqtt.c
CSRCS += new_cfg.c
CSRCS += new_common.c
CSRCS += new_ping.c
CSRCS += new_pins.c
CSRCS += rgb2hsv.c
CSRCS += tiny_crc8.c
CSRCS += user_main.c
#CSRCS += cmnds/cmd_send.c
CSRCS += driver/drv_adcButton.c
CSRCS += driver/drv_adcSmoother.c
CSRCS += driver/drv_aht2x.c
CSRCS += driver/drv_battery.c
CSRCS += driver/drv_bl_shared.c
CSRCS += driver/drv_bl0937.c
CSRCS += driver/drv_bl0942.c
#CSRCS += driver/drv_bmp280.c
CSRCS += driver/drv_bmpi2c.c
CSRCS += driver/drv_bp1658cj.c
CSRCS += driver/drv_bp5758d.c
CSRCS += driver/drv_bridge_driver.c
CSRCS += driver/drv_chargingLimit.c
CSRCS += driver/drv_charts.c
CSRCS += driver/drv_cht8305.c
CSRCS += driver/drv_cse7766.c
CSRCS += driver/drv_ddp.c
CSRCS += driver/drv_debouncer.c
CSRCS += driver/drv_dht_internal.c
CSRCS += driver/drv_dht.c
CSRCS += driver/drv_doorSensorWithDeepSleep.c
CSRCS += driver/drv_gn6932.c
CSRCS += driver/drv_hd2015.c
CSRCS += driver/drv_ht16k33.c
CSRCS += driver/drv_httpButtons.c
CSRCS += driver/drv_hue.c
CSRCS += driver/drv_kp18058.c
CSRCS += driver/drv_kp18068.c
CSRCS += driver/drv_max72xx_clock.c
CSRCS += driver/drv_max72xx_internal.c
CSRCS += driver/drv_max72xx_single.c
CSRCS += driver/drv_mcp9808.c
CSRCS += driver/drv_ntp_events.c
CSRCS += driver/drv_ntp.c
CSRCS += driver/drv_pt6523.c
CSRCS += driver/drv_pwm_groups.c
CSRCS += driver/drv_pwmToggler.c
CSRCS += driver/drv_pwrCal.c
CSRCS += driver/drv_rn8209.c
CSRCS += driver/drv_sgp.c
CSRCS += driver/drv_shiftRegister.c
CSRCS += driver/drv_sht3x.c
#CSRCS += driver/drv_sm15155e.c
#CSRCS += driver/drv_sm16703P.c
CSRCS += driver/drv_sm2135.c
CSRCS += driver/drv_sm2235.c
CSRCS += driver/drv_soft_i2c.c
#CSRCS += driver/drv_soft_spi.c
#CSRCS += driver/drv_spi_flash.c
#CSRCS += driver/drv_spi.c
#CSRCS += driver/drv_spidma.c
CSRCS += driver/drv_ssdp.c
CSRCS += driver/drv_tasmotaDeviceGroups.c
CSRCS += driver/drv_test_drivers.c
CSRCS += driver/drv_textScroller.c
CSRCS += driver/drv_tm_gn_display_shared.c
CSRCS += driver/drv_tm1637.c
CSRCS += driver/drv_tm1638.c
CSRCS += driver/drv_tuyaMCU.c
CSRCS += driver/drv_tuyaMCUSensor.c
CSRCS += driver/drv_uart.c
CSRCS += driver/drv_ucs1912.c
CSRCS += driver/drv_wemo.c
CSRCS += driver/drv_ds1820_simple.c
#CSRCS += httpclient/http_client.c
#CSRCS += httpclient/utils_net.c
#CSRCS += httpclient/utils_timer.c
CSRCS += i2c/drv_i2c_lcd_pcf8574t.c
CSRCS += i2c/drv_i2c_main.c
CSRCS += i2c/drv_i2c_mcp23017.c
CSRCS += i2c/drv_i2c_tc74.c
CSRCS += littlefs/lfs_util.c
CSRCS += littlefs/lfs.c
CSRCS += littlefs/our_lfs.c
#CSRCS += memory/memtest.c
#CSRCS += ota/ota.c
#CSRCS += sim/sim_uart.c
1 change: 1 addition & 0 deletions sdk/OpenTR6260
Submodule OpenTR6260 added at 9deb1e
4 changes: 2 additions & 2 deletions src/cmnds/cmd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static commandResult_t CMD_ClearAll(const void* context, const char* cmd, const
CHANNEL_ClearAllChannels();
CMD_ClearAllHandlers(0, 0, 0, 0);
RepeatingEvents_Cmd_ClearRepeatingEvents(0, 0, 0, 0);
#if defined(WINDOWS) || defined(PLATFORM_BL602) || defined(PLATFORM_BEKEN) || defined(PLATFORM_LN882H)
#if defined(WINDOWS) || defined(PLATFORM_BL602) || defined(PLATFORM_BEKEN) || defined(PLATFORM_LN882H) || defined(PLATFORM_TR6260)
CMD_resetSVM(0, 0, 0, 0);
#endif

Expand Down Expand Up @@ -855,7 +855,7 @@ void CMD_Init_Early() {
CMD_RegisterCommand("IndexRefreshInterval", CMD_IndexRefreshInterval, NULL);


#if (defined WINDOWS) || (defined PLATFORM_BEKEN) || (defined PLATFORM_BL602) || (defined PLATFORM_LN882H) || (defined PLATFORM_ESPIDF)
#if (defined WINDOWS) || (defined PLATFORM_BEKEN) || (defined PLATFORM_BL602) || (defined PLATFORM_LN882H) || (defined PLATFORM_ESPIDF) || defined(PLATFORM_TR6260)
CMD_InitScripting();
#endif
if (!bSafeMode) {
Expand Down
2 changes: 2 additions & 0 deletions src/driver/drv_ds1820_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ void usleepds(int r)
usleep(5 * r); // "5" seems o.k
#elif PLATFORM_ESPIDF
usleep(r);
#elif PLATFORM_TR6260
usdelay(r);
#else
for(volatile int i = 0; i < r; i++)
{
Expand Down
15 changes: 15 additions & 0 deletions src/hal/tr6260/hal_adc_tr6260.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifdef PLATFORM_TR6260

#include "../hal_adc.h"

void HAL_ADC_Init(int pinNumber)
{

}

int HAL_ADC_Read(int pinNumber)
{

}

#endif // PLATFORM_TR6260
18 changes: 18 additions & 0 deletions src/hal/tr6260/hal_flashConfig_tr6260.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifdef PLATFORM_TR6260

#include "../hal_flashConfig.h"
#include <easyflash.h>

int HAL_Configuration_ReadConfigMemory(void* target, int dataLen)
{
return ef_get_env_blob("ObkCfg", target, dataLen, NULL);
}

int HAL_Configuration_SaveConfigMemory(void* src, int dataLen)
{
//ef_del_env("ObkCfg");
ef_set_env_blob("ObkCfg", src, dataLen);
return 1;
}

#endif // PLATFORM_TR6260
Loading

0 comments on commit 532a903

Please sign in to comment.