add ota build script

This commit is contained in:
Shuanglei Tao
2025-05-14 14:42:48 +08:00
parent 69fb9e707b
commit 57460175bb
12 changed files with 2759 additions and 14 deletions

6
.gitignore vendored
View File

@@ -45,6 +45,8 @@
# Generated output files
Keil/Listings/*
Keil/Objects/*
Keil/_build*/
_build/
# Debugger files
# define exception below if needed
@@ -80,7 +82,9 @@ Keil/Objects/*
# !my_customized_scatter_file.sct
!SDK/*/components/softdevice/*/hex/*.hex
_build/
!tools/bootloader/*.hex
!tools/bin/*.exe
!tools/*.bat
RTE_Components.h
EventRecorderStub.scvd
JLinkLog.txt

View File

@@ -48,14 +48,14 @@
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\_build\</OutputDirectory>
<OutputDirectory>.\_build_DFU51\</OutputDirectory>
<OutputName>bl_nrf51822_xxaa_s130</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\_build\</ListingPath>
<ListingPath>.\_build_DFU51\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>

View File

@@ -48,14 +48,14 @@
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\_build\</OutputDirectory>
<OutputName>nrf52811_xxaa_s112</OutputName>
<OutputDirectory>.\_build_DFU52\</OutputDirectory>
<OutputName>bl_nrf52811_xxaa_s112</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\_build\</ListingPath>
<ListingPath>.\_build_DFU52\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>

View File

@@ -48,14 +48,14 @@
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputDirectory>.\_build_nRF51\</OutputDirectory>
<OutputName>EPD-nRF51</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<ListingPath>.\_build_nRF51\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
@@ -80,9 +80,9 @@
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg1Name>..\tools\make-ota-nrf51.bat $L @L</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>

View File

@@ -48,14 +48,14 @@
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputDirectory>.\_build_nRF52\</OutputDirectory>
<OutputName>EPD-nRF52</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<ListingPath>.\_build_nRF52\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
@@ -80,9 +80,9 @@
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg1Name>..\tools\make-ota-nrf52.bat $L @L</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>

BIN
tools/bin/mergehex.exe Normal file

Binary file not shown.

BIN
tools/bin/nrfutil.exe Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

16
tools/make-ota-nrf51.bat Normal file
View File

@@ -0,0 +1,16 @@
@echo off
set PATH=%PATH%;%~dp0bin
set fw_ver=0x16
set fw_hex=%1%2.hex
set p_key=%~dp0priv.pem
set bl_hex=%~dp0bootloader\bl_nrf51822_xxaa_s130.hex
set sd_hex=%~dp0..\SDK\12.3.0_d7731ad\components\softdevice\s130\hex\s130_nrf51_2.0.1_softdevice.hex
set settings=%1%2-settings.hex
set fw_full_hex=%1%2-full.hex
set ota_zip=%1%2-ota.zip
nrfutil pkg generate --application %fw_hex% --key-file %p_key% --hw-version 51 --sd-req 0x87 --sd-id 0x87 --application-version %fw_ver% %ota_zip%
nrfutil settings generate --family NRF51 --application %fw_hex% --softdevice %sd_hex% --application-version %fw_ver% --bootloader-version 1 --bl-settings-version 1 --key-file %p_key% --no-backup %settings%
mergehex -m %sd_hex% %bl_hex% %fw_hex% %settings% -o %fw_full_hex%

16
tools/make-ota-nrf52.bat Normal file
View File

@@ -0,0 +1,16 @@
@echo off
set PATH=%PATH%;%~dp0bin
set fw_ver=0x16
set fw_hex=%1%2.hex
set p_key=%~dp0priv.pem
set bl_hex=%~dp0bootloader\bl_nrf52811_xxaa_s112.hex
set sd_hex=%~dp0..\SDK\17.1.0_ddde560\components\softdevice\s112\hex\s112_nrf52_7.2.0_softdevice.hex
set settings=%1%2-settings.hex
set fw_full_hex=%1%2-full.hex
set ota_zip=%1%2-ota.zip
nrfutil pkg generate --application %fw_hex% --key-file %p_key% --hw-version 52 --sd-req 0x103 --sd-id 0x103 --application-version %fw_ver% %ota_zip%
nrfutil settings generate --family NRF52810 --application %fw_hex% --softdevice %sd_hex% --application-version %fw_ver% --bootloader-version 1 --bl-settings-version 1 --key-file %p_key% --no-backup %settings%
mergehex -m %sd_hex% %bl_hex% %fw_hex% %settings% -o %fw_full_hex%

5
tools/priv.pem Normal file
View File

@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIMZHWw16Q+F1+mV2qg1jKQ4tevgGRDWizqPTnHcFaLvVoAoGCCqGSM49
AwEHoUQDQgAEGFGuC3G4pI3SfB56dwDmjGVV5aVRe4n+mMrrc46ZP89VXiFslv4G
8rN7NI34wcD+bxn3tbzj3aBYDgwZx+MiCA==
-----END EC PRIVATE KEY-----