Skip to content

Commit a191140

Browse files
theotherjimmyadbridge
authored andcommitted
Tools: Fix Python3 + firmware header traeback
### Description Traceback: ``` Merging Regions Filling region bootloader with mbed-cloud-client-example/mbed-os/features/FEATURE_BOOTLOADER/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/TARGET_FRDM/mbed-bootloader-k64f-block_device-sotp-v3_4_0.bin Padding region bootloader with 0x9a4 bytes Traceback (most recent call last): File "mbed-cloud-client-example/mbed-os/tools/make.py", line 293, in <module> ignore=options.ignore File "mbed-cloud-client-example/mbed-os/tools/build_api.py", line 548, in build_project merge_region_list(region_list, res, notify) File "mbed-cloud-client-example/mbed-os/tools/build_api.py", line 423, in merge_region_list _fill_header(region_list, region).tofile(header_filename, format='hex') File "mbed-cloud-client-example/mbed-os/tools/build_api.py", line 380, in _fill_header header.puts(start, struct.pack(fmt, time())) struct.error: required argument is not an integer ``` reason: `time()` returns a float. So the fix is to force it to be an `int`. ### Pull request type [x] Fix [ ] Refactor [ ] Target update [ ] Functionality change [ ] Breaking change
1 parent b3d935c commit a191140

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/build_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def _fill_header(region_list, current_region):
377377
elif type == "timestamp":
378378
fmt = {"32le": "<L", "64le": "<Q",
379379
"32be": ">L", "64be": ">Q"}[subtype]
380-
header.puts(start, struct.pack(fmt, time()))
380+
header.puts(start, struct.pack(fmt, int(time())))
381381
elif type == "size":
382382
fmt = {"32le": "<L", "64le": "<Q",
383383
"32be": ">L", "64be": ">Q"}[subtype]

0 commit comments

Comments
 (0)