Skip to content

Commit

Permalink
feat: Add combine factory firmware for Emake command
Browse files Browse the repository at this point in the history
  • Loading branch information
xcguang committed Jan 8, 2020
1 parent ee7ae05 commit dee9cd6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
14 changes: 7 additions & 7 deletions .gitlab-ci.yml
Expand Up @@ -22,7 +22,7 @@ esp32_wroom_at:
- build/customized_partitions/*.bin
- build/flasher_args.json
- build/download.config
# - build/factory/*
- build/factory/*
expire_in: 6 mos

before_script:
Expand Down Expand Up @@ -87,7 +87,7 @@ esp32_wrover_at:
- build/customized_partitions/*.bin
- build/flasher_args.json
- build/download.config
# - build/factory/*
- build/factory/*
expire_in: 6 mos

before_script:
Expand Down Expand Up @@ -154,7 +154,7 @@ pico_d4_at:
- build/customized_partitions/*.bin
- build/flasher_args.json
- build/download.config
# - build/factory/*
- build/factory/*
expire_in: 6 mos

before_script:
Expand Down Expand Up @@ -222,7 +222,7 @@ solo_1_at:
- build/customized_partitions/*.bin
- build/flasher_args.json
- build/download.config
# - build/factory/*
- build/factory/*
expire_in: 6 mos

before_script:
Expand Down Expand Up @@ -289,7 +289,7 @@ esp8266_wroom_02_at:
- build/customized_partitions/*.bin
- build/flasher_args.json
- build/download.config
# - build/factory/*
- build/factory/*
expire_in: 6 mos

before_script:
Expand Down Expand Up @@ -354,7 +354,7 @@ esp8266_wroom_5V2L_at:
- build/customized_partitions/*.bin
- build/flasher_args.json
- build/download.config
# - build/factory/*
- build/factory/*
expire_in: 6 mos

before_script:
Expand Down Expand Up @@ -490,7 +490,7 @@ wrover32_all_function_at:
- build/customized_partitions/*.bin
- build/flasher_args.json
- build/download.config
# - build/factory/*
- build/factory/*
expire_in: 6 mos

before_script:
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Expand Up @@ -87,17 +87,17 @@ include(${IDF_PATH}/tools/cmake/project.cmake)

project(esp-at)


add_custom_target(factory_bin ALL DEPENDS app)
add_custom_command(OUTPUT factory_bin
add_custom_command(TARGET factory_bin
POST_BUILD
COMMAND mkdir -p $ENV{ESP_AT_PROJECT_PATH}/build/factory
COMMAND ${PYTHON} $ENV{ESP_AT_PROJECT_PATH}/tools/esp_at_factory_bin_combine_cmake.py
COMMAND ${PYTHON} $ENV{ESP_AT_PROJECT_PATH}/tools/esp_at_factory_bin_combine.py
--module_name $ENV{ESP_AT_MODULE_NAME}
--bin_directory $ENV{ESP_AT_PROJECT_PATH}/build
--flash_mode ${CONFIG_ESPTOOLPY_FLASHMODE}
--flash_size ${CONFIG_ESPTOOLPY_FLASHSIZE}
--flash_speed ${CONFIG_ESPTOOLPY_FLASHFREQ}
--parameter_file $ENV{ESP_AT_PROJECT_PATH}/build/factory/factory_parameter.log
--download_config $ENV{ESP_AT_PROJECT_PATH}/build/flash_project_args
COMMENT "Create factory bin..."
)
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -91,4 +91,5 @@ factory_bin:
--flash_mode $(CONFIG_ESPTOOLPY_FLASHMODE) \
--flash_size $(CONFIG_ESPTOOLPY_FLASHSIZE) \
--flash_speed $(CONFIG_ESPTOOLPY_FLASHFREQ) \
--parameter_file $(PROJECT_PATH)/build/factory/factory_parameter.log
--parameter_file $(PROJECT_PATH)/build/factory/factory_parameter.log \
--download_config $(PROJECT_PATH)/build/download.config
9 changes: 5 additions & 4 deletions tools/esp_at_factory_bin_combine.py
Expand Up @@ -31,10 +31,10 @@
ESP_BIN_SIZE = {"1MB": 1024*1024, "2MB": 2*1024*1024, "4MB": 4*1024*1024, "8MB": 8*1024*1024, "16MB": 16*1024*1024}
ESP_FLASH_SPEED = {"40M": 0, "26M": 1, "20M": 2, "80M": 3}

def esp32_at_combine_bin(modlule, flash_mode, flash_size, flash_speed, build_dir, parameter_file):
def esp32_at_combine_bin(modlule, flash_mode, flash_size, flash_speed, build_dir, parameter_file, download_config):
bin_data = bytearray([0xFF] * (ESP_BIN_SIZE[flash_size]))

with open(os.path.join(build_dir, 'download.config')) as f:
with open(download_config) as f:
data = f.read()
address_list = re.compile(r"0x[\da-fA-F]+ \S+").findall(data)

Expand Down Expand Up @@ -89,10 +89,11 @@ def main():
parser.add_argument("--flash_speed", default="40M", help="Flash speed: 40M,26M,20M,80M")
parser.add_argument("--bin_directory", default="build", help="build directory")
parser.add_argument("--parameter_file", default=None, help="factory parameter file")
parser.add_argument("--download_config", default='download.config', help="flash download config file")
args = parser.parse_args()

esp32_at_combine_bin(args.module_name.upper(), args.flash_mode.upper(), args.flash_size.upper(), args.flash_speed.upper(), args.bin_directory, args.parameter_file)

esp32_at_combine_bin(args.module_name.upper(), args.flash_mode.upper(), args.flash_size.upper(),
args.flash_speed.upper(), args.bin_directory, args.parameter_file, args.download_config)

if __name__ == '__main__':
main()

0 comments on commit dee9cd6

Please sign in to comment.