Example #1
0
def write_app_linker_files(platforms, softdevices, timestamp, outdirs):
    d = {}
    for p in platforms:
        for sd in p["softdevices"]:
            if "s110" in sd["name"].lower():
                continue
            print("Writing application linker files for: {p[name]} {sd[name]}".
                  format(p=p, sd=sd))

            d["application"] = get_application_limits(p, sd)
            d["softdevice"] = sd
            d["platform"] = p
            d["scriptname"] = SCRIPTNAME
            d["timestamp"] = timestamp
            for outdir in outdirs:
                print("-- ", outdir)
                configure_linker_file(
                    "tools/linker/templates/armcc.sct.template",
                    "{outdir}/{platform}_{sd}.sct".format(outdir=outdir,
                                                          platform=p["name"],
                                                          sd=sd["name"]), d)
                configure_linker_file(
                    "tools/linker/templates/gccarmemb.ld.template",
                    "{outdir}/{platform}_{sd}.ld".format(outdir=outdir,
                                                         platform=p["name"],
                                                         sd=sd["name"]), d)
Example #2
0
    def generate_entries(self, platform, softdevice, bootloader_config):
        public_key = bootloader_config["public_key"] \
                     if "public_key" in bootloader_config else None
        if public_key:
            self.entries.append(
                DevicePageEntry(BLInfoType.ECDSA_PUBLIC_KEY, public_key))

        app_limits = get_application_limits(platform, softdevice)
        app_segment = bytearray(struct.pack("<II",
                                            app_limits["flash_start"],
                                            app_limits["flash_size"]))
        sd_segment = bytearray(struct.pack("<II",
                                           softdevice["flash_start"],
                                           softdevice["flash_size"]))
        bl_segment = bytearray(struct.pack("<II",
                                           platform["bootloader"]["flash_start"],
                                           platform["bootloader"]["flash_size"]))

        self.entries.append(
            DevicePageEntry(BLInfoType.SEGMENT_APP, app_segment))
        self.entries.append(
            DevicePageEntry(BLInfoType.SEGMENT_SD, sd_segment))
        self.entries.append(
            DevicePageEntry(BLInfoType.SEGMENT_BL, bl_segment))

        version_data = bytearray(struct.pack("<HBBIHI",
                                             int(softdevice["version"], 16),
                                             bootloader_config["bootloader_id"],
                                             bootloader_config["bootloader_version"],
                                             bootloader_config["company_id"],
                                             bootloader_config["application_id"],
                                             bootloader_config["application_version"]))

        #print(version_data)
        self.entries.append(DevicePageEntry(BLInfoType.VERSION,
                                            version_data))

        self.entries.append(DevicePageEntry(BLInfoType.FLAGS,
                                            bytearray(struct.pack('I', 0xFFFFFFFF))))