From 861e741030e6794f49df090a67ed69fa674e680c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Sat, 28 Jan 2023 12:50:37 +0100 Subject: [PATCH] [beken-72xx] Disable OTA encryption --- boards/_base/beken-72xx.json | 6 ++---- builder/frameworks/beken-72xx-sdk.py | 11 +++-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/boards/_base/beken-72xx.json b/boards/_base/beken-72xx.json index bbbaef8..ba8b5ea 100644 --- a/boards/_base/beken-72xx.json +++ b/boards/_base/beken-72xx.json @@ -3,10 +3,8 @@ "f_cpu": "120000000L", "prefix": "arm-none-eabi-", "bkota": { - "encryption": "aes256", - "compression": "gzip", - "key": "0123456789ABCDEF0123456789ABCDEF", - "iv": "0123456789ABCDEF" + "encryption": "none", + "compression": "gzip" } }, "connectivity": [ diff --git a/builder/frameworks/beken-72xx-sdk.py b/builder/frameworks/beken-72xx-sdk.py index f817fa3..29bad9a 100644 --- a/builder/frameworks/beken-72xx-sdk.py +++ b/builder/frameworks/beken-72xx-sdk.py @@ -2,17 +2,12 @@ from os.path import join +from ltchiptool.soc.bk72xx.binary import to_offset from SCons.Script import Builder, DefaultEnvironment env = DefaultEnvironment() board = env.BoardConfig() -# Install PyCryptodome for OTA packaging with AES -try: - import Cryptodome -except ImportError: - env.Execute("$PYTHONEXE -m pip install pycryptodomex") - ROOT_DIR = join("$SDK_DIR", "beken378") APP_DIR = join(ROOT_DIR, "app") DRIVER_DIR = join(ROOT_DIR, "driver") @@ -567,8 +562,8 @@ env.Replace( # Calculate RBL header offset app_offs = int(env["FLASH_APP_OFFSET"], 16) app_size = int(board.get("build.bkrbl_size_app"), 16) -rbl_offs = int(app_size // 32 * 34) - 102 -env.Replace(FLASH_RBL_OFFSET=f"0x{app_offs + rbl_offs:06X}") +rbl_offs = app_offs + to_offset(app_size) - 102 +env.Replace(FLASH_RBL_OFFSET=f"0x{rbl_offs:06X}") # Build all libraries env.BuildLibraries()