Package: cc1352-flasher
Before finalizing this fork, this commit needs to include moving to git.beagleboard.org CI.CC1352 flasher for BeaglePlay and BeagleConnect FreedomThis folder contains a python script that communicates with the boot loader of the Texas Instruments CC13xx SoCs (System on Chips) on BeaglePlay or BeagleConnect Freedom.
It can be used to erase, program, verify and read the flash of those SoCs with a simple USB to serial converter.RequirementsTo run this script you need a Python interpreter, Linux and Mac users should be fine, Windows users have a look here:Python Download.Alternatively, Docker can be used to run this script as a one-liner without the need to install dependencies, seegit-developer/ti-cc-toolfor details.BeaglePlay provides the required GPIO and UART connections between the AM62 and CC1352 to enable programming using the CC1352 serial BSL.BeagleConnect Freedom provides a USB to serial bridge to the CC1352 to enable programming using the CC1352 serial BSL.DependenciesThis script uses the pyserial package to communicate with the serial port and chip (https://pypi.org/project/pyserial/). You can install it by runningpip install pyserial.If you want to be able to program your device from an Intel Hex file, you will need to install the IntelHex package:https://pypi.python.org/pypi/IntelHex(e.g. by runningpip install intelhex).The script will try to auto-detect whether your firmware is a raw binary or an Intel Hex by using python-magic:
(https://pypi.python.org/pypi/python-magic). You can install it by runningpip install python-magic. Please bear in mind that installation of python-magic may have additional dependencies, depending on your OS: (https://github.com/ahupp/python-magic#dependencies).If python-magic isnotinstalled, the script will try to auto-detect the firmware type by looking at the filename extension, but this is sub-optimal. If the extension is.hex,.ihxor.ihex, the script will assume that the firmware is an Intel Hex file. In all other cases, the firmware will be treated as raw binary.BeagleConnect FreedomThe MSP430 USB-to-UART bridge inBeagleConnect Freedomuses a serialBREAKto know when to invoke the CC1352P7 BSL. Use--bootloader-send-breakto activate the bootloader.BeaglePlayThe GPIOs onBeaglePlayare toggled using thegpiodlibrary and found via the device tree provided labels. Use--playto select these gpios and the proper UART.Other notesFor all the CC13xx and CC26xx families, the ROM bootloader is configured through theBL_CONFIG'register' in CCFG.BOOTLOADER_ENABLEshould be set to0xC5to enable the bootloader in the first place.This is enough if the chip has not been programmed with a valid image. If a valid image is present, then the remaining fields ofBL_CONFIGand theERASE_CONFregister must also be configured correctly:Select a DIO by settingBL_PIN_NUMBERSelect an active level (low/high) for the DIO by settingBL_LEVELEnable 'failure analysis' by settingBL_ENABLEto0xC5Make sure theBANK_ERASEcommand is enabled: TheBANK_ERASE_DIS_Nbit in theERASE_CONFregister in CCFG must be set.BANK_ERASEis enabled by default.If you are using CC13xx/CC26xxware, the relevant settings are understartup_files/ccfg.c. This is the case if you are using Contiki.Similar to the CC2538, the bootloader will be activated if, at the time of reset, failure analysis is enabled and the selected DIO is found to be at the active level.As an example, to bind the bootloader backdoor to KEY_SELECT on the SmartRF06EB, you need to set the following:BOOTLOADER_ENABLE = 0xC5(Bootloader enable.SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLEin CC13xx/CC26xxware)BL_LEVEL = 0x00(Active low.SET_CCFG_BL_CONFIG_BL_LEVELin CC13xx/CC26xxware)BL_PIN_NUMBER = 0x0B(DIO 11.SET_CCFG_BL_CONFIG_BL_PIN_NUMBERin CC13xx/CC26xxware)BL_ENABLE = 0xC5(Enable "failure analysis".SET_CCFG_BL_CONFIG_BL_ENABLEin CC13xx/CC26xxware)These settings are very useful for development, but enabling failure analysis in a deployed firmware may allow a malicious user to read out the contents of your device's flash or to erase it. Do not enable this in a deployment unless you understand the security implications.UsageInstall from PyPi usingpip install cc1352-flasheror using the local repo usingpip install ..You can find info on the various options by executingcc1352-flasher -h.RemarksIf you found a bug or improved some part of the code, please submit anissueor pull request.AuthorsJason Kridner, BeagleBoard.org (c) 2023,jkridner@beagleboard.orgJelmer Tiete (c) 2014,jelmer@tiete.beLoosly based onstm32loaderby Ivan A-Rivan@tuxotronic.org