自动生成升级固件(bootloader).bat 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. @echo off
  2. rem The process of generating DFU files
  3. set name="yingying"
  4. set BLE_DFU_ENANBLE_flag=0
  5. set BleNameHoldOn_ENANBLE_flag=0
  6. set BleNameHoldOn_ENANBLE_flag=0
  7. set RTT_DEBUG_EN_flag=0
  8. set USE_FIFO_FLAG=0
  9. echo=
  10. echo **********************Ready To generate DFU bootloader zip FILE*****************
  11. echo=
  12. cd ..
  13. rem KEIL directory
  14. set UV=C:\Keil_v5\UV4\UV4.exe
  15. rem Current directory
  16. set Front_PRO_PATH=%cd%
  17. rem Project directory
  18. set UV_PRO_PATH=%Front_PRO_PATH%\pca10040\s132\arm5_no_packs\ble_app_uart_c_pca10040_s132.uvprojx
  19. rem Project output directory
  20. set BUILD_HEX_NAME=%Front_PRO_PATH%\pca10040\s132\arm5_no_packs\_build\nrf52832_xxaa.hex
  21. rem Directory of file names for DFU enabled in the current project
  22. set USR_CONFIG_PACH=%Front_PRO_PATH%\system\usr_config.h
  23. rem Directory to store dfu files and settings
  24. set DFU_CONFIG_FILE_NAME=%cd%\dfu_readme
  25. rem bootloader name
  26. set BOOTLOADER_NAME=%DFU_CONFIG_FILE_NAME%\central_and_peripheral_bootloader.hex
  27. rem Generate the name of the DFU file
  28. set DFU_FILE_NAME=%DFU_CONFIG_FILE_NAME%\bootloader_dfu_package.zip
  29. rem Clear previous DFU files and compiled HEX files
  30. if exist %DFU_FILE_NAME% del %DFU_FILE_NAME%
  31. if exist %BUILD_HEX_NAME% del %BUILD_HEX_NAME%
  32. findstr /c:"BleNameHoldOn_ENANBLE 1" %USR_CONFIG_PACH%>nul
  33. if %errorlevel% equ 0 set /a BleNameHoldOn_ENANBLE_flag=1
  34. findstr /c:"BLE_DFU_ENANBLE 1" %USR_CONFIG_PACH%>nul
  35. if %errorlevel% equ 0 set /a BLE_DFU_ENANBLE_flag=1
  36. findstr /c:"JS_RTT_DEBUG_EN 1" %USR_CONFIG_PACH%>nul
  37. if %errorlevel% equ 0 set /a RTT_DEBUG_EN_flag=1
  38. findstr /c:"USEFIFO 1" %USR_CONFIG_PACH%>nul
  39. if %errorlevel% equ 0 set /a USE_FIFO_FLAG=1
  40. if %BLE_DFU_ENANBLE_flag% equ 1 (
  41. if %BleNameHoldOn_ENANBLE_flag% equ 0 (
  42. echo=
  43. echo Compile firmware in progress ----------------
  44. echo=
  45. %UV% -j0 -b %UV_PRO_PATH% -l %cd%\build_log.txt
  46. if exist %BUILD_HEX_NAME% (
  47. nrfutil pkg generate --hw-version 52 --bootloader-version 0x03 --bootloader %BOOTLOADER_NAME% --sd-req 0xcb --key-file .\dfu_readme\private.key %DFU_FILE_NAME%
  48. echo=
  49. echo file generated successfully
  50. echo=
  51. echo ================Firmware information============================
  52. echo | set /p="hardware version "
  53. findstr "\<HARDWARE_VERSION" %USR_CONFIG_PACH%
  54. echo | set /p="Software version "
  55. findstr "\<SOFTWARE_VERSION" %USR_CONFIG_PACH%
  56. if %RTT_DEBUG_EN_flag% equ 1 (
  57. echo RTT waveform display is on! ! ! ! ! ! !
  58. )
  59. if %USE_FIFO_FLAG% equ 1 (
  60. echo BLE transmission, using FIFO transmission
  61. )
  62. echo | set /p="Standby Power Interval(ms) "
  63. findstr /c:"#define StandByPower_Interval" %USR_CONFIG_PACH%
  64. echo | set /p="Heartbeat interval (ms) "
  65. findstr /c:"#define HeartTime_Interval" %USR_CONFIG_PACH%
  66. echo | set /p="Low Power Interval(ms) "
  67. findstr /c:"#define LowPower_Interval" %USR_CONFIG_PACH%
  68. echo ===================================================
  69. echo=
  70. pause
  71. )
  72. )
  73. )
  74. echo !!!!!!!!!Failed to compile the project!!!!!!!!!!!!
  75. echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  76. if %BLE_DFU_ENANBLE_flag% equ 0 (
  77. echo The project does not enable the firmware upgrade function, please confirm
  78. )
  79. if %BleNameHoldOn_ENANBLE_flag% equ 1 (
  80. echo The project has enabled the fixed function of the bluetooth name, please confirm
  81. )
  82. echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  83. echo=
  84. pause