Clone of official tools

Committer:
Anders Blomdell
Date:
Thu Feb 04 17:17:13 2021 +0100
Revision:
47:21ae3e5a7128
Parent:
44:bad0b339f97d
Add a few normpath calls

Who changed what in which revision?

UserRevisionLine numberNew contents of line
theotherjimmy 44:bad0b339f97d 1 /* mbed Microcontroller Library
theotherjimmy 44:bad0b339f97d 2 * Copyright (c) 2017 ARM Limited
theotherjimmy 44:bad0b339f97d 3 *
theotherjimmy 44:bad0b339f97d 4 * Licensed under the Apache License, Version 2.0 (the "License");
theotherjimmy 44:bad0b339f97d 5 * you may not use this file except in compliance with the License.
theotherjimmy 44:bad0b339f97d 6 * You may obtain a copy of the License at
theotherjimmy 44:bad0b339f97d 7 *
theotherjimmy 44:bad0b339f97d 8 * http://www.apache.org/licenses/LICENSE-2.0
theotherjimmy 44:bad0b339f97d 9 *
theotherjimmy 44:bad0b339f97d 10 * Unless required by applicable law or agreed to in writing, software
theotherjimmy 44:bad0b339f97d 11 * distributed under the License is distributed on an "AS IS" BASIS,
theotherjimmy 44:bad0b339f97d 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
theotherjimmy 44:bad0b339f97d 13 * See the License for the specific language governing permissions and
theotherjimmy 44:bad0b339f97d 14 * limitations under the License.
theotherjimmy 44:bad0b339f97d 15 */
theotherjimmy 44:bad0b339f97d 16
theotherjimmy 44:bad0b339f97d 17 #include "flash_api.h"
theotherjimmy 44:bad0b339f97d 18 #include "flash_data.h"
theotherjimmy 44:bad0b339f97d 19 #include "platform/mbed_critical.h"
theotherjimmy 44:bad0b339f97d 20
theotherjimmy 44:bad0b339f97d 21 // This file is automatically generated
theotherjimmy 44:bad0b339f97d 22
theotherjimmy 44:bad0b339f97d 23 #if DEVICE_FLASH
theotherjimmy 44:bad0b339f97d 24
theotherjimmy 44:bad0b339f97d 25 // This is a flash algo binary blob. It is PIC (position independent code) that should be stored in RAM
theotherjimmy 44:bad0b339f97d 26 static uint32_t FLASH_ALGO[] = {
theotherjimmy 44:bad0b339f97d 27 {{algo.format_algo_data(4, 8, "c")}}
theotherjimmy 44:bad0b339f97d 28 };
theotherjimmy 44:bad0b339f97d 29
theotherjimmy 44:bad0b339f97d 30 static const flash_algo_t flash_algo_config = {
theotherjimmy 44:bad0b339f97d 31 .init = {{'0x%x' % algo.symbols['Init']}},
theotherjimmy 44:bad0b339f97d 32 .uninit = {{'0x%x' % algo.symbols['UnInit']}},
theotherjimmy 44:bad0b339f97d 33 .erase_sector = {{'0x%x' % algo.symbols['EraseSector']}},
theotherjimmy 44:bad0b339f97d 34 .program_page = {{'0x%x' % algo.symbols['ProgramPage']}},
theotherjimmy 44:bad0b339f97d 35 .static_base = {{'0x%x' % algo.rw_start}},
theotherjimmy 44:bad0b339f97d 36 .algo_blob = FLASH_ALGO
theotherjimmy 44:bad0b339f97d 37 };
theotherjimmy 44:bad0b339f97d 38
theotherjimmy 44:bad0b339f97d 39 static const sector_info_t sectors_info[] = {
theotherjimmy 44:bad0b339f97d 40 {%- for start, size in algo.sector_sizes %}
theotherjimmy 44:bad0b339f97d 41 {{ "{0x%x, 0x%x}" % (start + algo.flash_start, size) }},
theotherjimmy 44:bad0b339f97d 42 {%- endfor %}
theotherjimmy 44:bad0b339f97d 43 };
theotherjimmy 44:bad0b339f97d 44
theotherjimmy 44:bad0b339f97d 45 static const flash_target_config_t flash_target_config = {
theotherjimmy 44:bad0b339f97d 46 .page_size = {{'0x%x' % algo.page_size}},
theotherjimmy 44:bad0b339f97d 47 .flash_start = {{'0x%x' % algo.flash_start}},
theotherjimmy 44:bad0b339f97d 48 .flash_size = {{'0x%x' % algo.flash_size}},
theotherjimmy 44:bad0b339f97d 49 .sectors = sectors_info,
theotherjimmy 44:bad0b339f97d 50 .sector_info_count = sizeof(sectors_info) / sizeof(sector_info_t)
theotherjimmy 44:bad0b339f97d 51 };
theotherjimmy 44:bad0b339f97d 52
theotherjimmy 44:bad0b339f97d 53 void flash_set_target_config(flash_t *obj)
theotherjimmy 44:bad0b339f97d 54 {
theotherjimmy 44:bad0b339f97d 55 obj->flash_algo = &flash_algo_config;
theotherjimmy 44:bad0b339f97d 56 obj->target_config = &flash_target_config;
theotherjimmy 44:bad0b339f97d 57 }
theotherjimmy 44:bad0b339f97d 58
theotherjimmy 44:bad0b339f97d 59 #endif