"0x8000" : "partition_table/partition-table.bin",
"${CONFIG_APP_OFFSET}" : "${PROJECT_NAME}.bin",
"${PHY_PARTITION_OFFSET}" : "${PHY_PARTITION_BIN_FILE}"
- }
+ },
+ "bootloader" : { "offset" : "0x1000",
+ "file" : "bootloader/bootloader.bin" },
+ "app" : { "offset" : "${CONFIG_APP_OFFSET}",
+ "file" : "${PROJECT_NAME}.bin" },
+ "partition_table" : { "offset" : "0x8000",
+ "file" : "partition_table/partition-table.bin" }
}
\r
This command will compile the application and all the ESP-IDF components, generate bootloader, partition table, and application binaries.\r
\r
+.. highlight: none\r
+\r
+::\r
+ $ idf.py build\r
+ Running cmake in directory /path/to/hello_world/build\r
+ Executing "cmake -G Ninja --warn-uninitialized /path/to/hello_world"...\r
+ Warn about uninitialized values.\r
+ -- Found Git: /usr/bin/git (found version "2.17.0")\r
+ -- Building empty aws_iot component due to configuration\r
+ -- Component names: ...\r
+ -- Component paths: ...\r
+ \r
+ ... (more lines of build system output)\r
+ \r
+ [527/527] Generating hello-world.bin\r
+ esptool.py v2.3.1\r
+ \r
+ Project build complete. To flash, run this command:\r
+ ../../../components/esptool_py/esptool/esptool.py -p (PORT) -b 921600 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x10000 build/hello-world.bin build 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin\r
+ or run 'idf.py flash'\r
+\r
+If there are no errors, the build will finish by generating the firmware binary .bin file.\r
+\r
Flash To A Device\r
=================\r
\r
else:
os.remove(f)
+def print_closing_message(args):
+ # print a closing message of some kind
+ #
+
+ if "flash" in str(args.actions):
+ print("Done")
+ return
+
+ # Otherwise, if we built any binaries print a message about
+ # how to flash them
+ def print_flashing_message(title, key):
+ print("\n%s build complete. To flash, run this command:" % title)
+
+ with open(os.path.join(args.build_dir, "flasher_args.json")) as f:
+ flasher_args = json.load(f)
+
+ def flasher_path(f):
+ return os.path.relpath(os.path.join(args.build_dir, f))
+
+ if key != "project":
+ cmd = ""
+ if key == "bootloader":
+ cmd = " ".join(flasher_args["write_flash_args"]) + " "
+
+ cmd += flasher_args[key]["offset"] + " "
+ cmd += flasher_path(flasher_args[key]["file"])
+ else:
+ cmd = " ".join(flasher_args["write_flash_args"]) + " "
+ for o,f in flasher_args["flash_files"].items():
+ cmd += o + " " + flasher_path(f) + " "
+
+ print("%s -p %s -b %s write_flash %s" % (
+ os.path.relpath("%s/components/esptool_py/esptool/esptool.py" % os.environ["IDF_PATH"]),
+ args.port or "(PORT)",
+ args.baud,
+ cmd.strip()))
+ print("or run 'idf.py %s'" % (key + "-flash" if key != "project" else "flash",))
+
+ if "all" in args.actions or "build" in args.actions:
+ print_flashing_message("Project", "project")
+ else:
+ if "app" in args.actions:
+ print_flashing_message("App", "app")
+ if "partition_table" in args.actions:
+ print_flashing_message("Partition Table", "partition_table")
+ if "bootloader" in args.actions:
+ print_flashing_message("Bootloader", "bootloader")
+
ACTIONS = {
# action name : ( function (or alias), dependencies, order-only dependencies )
"all" : ( build_target, [], [ "reconfigure", "menuconfig", "clean", "fullclean" ] ),
result.append(a)
return result
-
def main():
if sys.version_info[0] != 2 or sys.version_info[1] != 7:
raise FatalError("ESP-IDF currently only supports Python 2.7, and this is Python %d.%d.%d. Search for 'Setting the Python Interpreter' in the ESP-IDF docs for some tips to handle this." % sys.version_info[:3])
completed_actions.add(action)
- while len(args.actions) > 0:
- execute_action(args.actions[0], args.actions[1:])
- args.actions.pop(0)
+ actions = list(args.actions)
+ while len(actions) > 0:
+ execute_action(actions[0], actions[1:])
+ actions.pop(0)
+ print_closing_message(args)
if __name__ == "__main__":
try: