mirror of
https://git.yoctoproject.org/meta-zephyr
synced 2026-09-15 18:49:31 +02:00
arduino-101: Support for flashing via USB
Implement a class allowing flashing Arduino-101 using dfu-util.
User needs to have dfu-utils installed on the host machine.
All three cores supported (x86, ARM, ARC).
Sample usage:
$ MACHINE=arduino-101 bitbake xxx
$ MACHINE=arduino-101 bitbake xxx -c flash_usb
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
This commit is contained in:
34
classes/zephyr-flash-dfu.bbclass
Normal file
34
classes/zephyr-flash-dfu.bbclass
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
python do_flash_usb() {
|
||||
import subprocess
|
||||
return_code = subprocess.call("which dfu-util", shell=True)
|
||||
if return_code != 0:
|
||||
bb.error("ERROR: dfu_util binary not in PATH")
|
||||
sys.exit(1)
|
||||
|
||||
board = d.getVar('BOARD',True)
|
||||
bb.warn("Attempting to flash board: %s" % board)
|
||||
|
||||
if board == 'arduino_101_sss':
|
||||
iface = 'sensor_core'
|
||||
elif board == 'arduino_101':
|
||||
iface = 'x86_app'
|
||||
elif board == 'arduino_101_ble':
|
||||
iface = 'ble_core'
|
||||
else:
|
||||
bb.error(" Unsupported board %s" % board)
|
||||
sys.exit(2)
|
||||
|
||||
image = "%s/%s.elf" % (d.getVar('DEPLOY_DIR_IMAGE', True), d.getVar('PN', True))
|
||||
statement = 'dfu-util -v -a ' + iface + ' -d 8087:0aba -D ' + image.replace('elf','bin')
|
||||
bb.note("command: %s" % statement)
|
||||
return_code = subprocess.call(statement, shell=True)
|
||||
if return_code != 0:
|
||||
bb.error("Error flashig the device [%d], reset needed?" % return_code)
|
||||
else:
|
||||
bb.warn("Success (return code %d)" % return_code)
|
||||
}
|
||||
|
||||
addtask do_flash_usb
|
||||
|
||||
do_flash_usb[nostamp] = "1"
|
||||
@@ -16,3 +16,4 @@ PREFERRED_VERSION_binutils-cross-${TARGET_ARCH} = "2.26+gitarc"
|
||||
PREFERRED_VERSION_binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} = "2.26+gitarc"
|
||||
|
||||
TARGET_LINK_HASH_STYLE = ""
|
||||
ZEPHYR_INHERIT_CLASSES += "zephyr-flash-dfu"
|
||||
|
||||
@@ -8,3 +8,4 @@ require conf/machine/include/tune-iamcu.inc
|
||||
TUNE_PKGARCH_arduino-101 = "iamcu"
|
||||
|
||||
TARGET_LINK_HASH_STYLE = ""
|
||||
ZEPHYR_INHERIT_CLASSES += "zephyr-flash-dfu"
|
||||
|
||||
Reference in New Issue
Block a user