mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

tools/flash_algo/c_blob_mbed.tmpl

Committer:
be_bryan
Date:
2017-12-11
Revision:
0:b74591d5ab33

File content as of revision 0:b74591d5ab33:

/* mbed Microcontroller Library
 * Copyright (c) 2017 ARM Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "flash_api.h"
#include "flash_data.h"
#include "platform/mbed_critical.h"

// This file is automatically generated

#if DEVICE_FLASH

// This is a flash algo binary blob. It is PIC (position independent code) that should be stored in RAM
static uint32_t FLASH_ALGO[] = {
    {{algo.format_algo_data(4, 8, "c")}}
};

static const flash_algo_t flash_algo_config = {
    .init = {{'0x%x' % algo.symbols['Init']}},
    .uninit = {{'0x%x' % algo.symbols['UnInit']}},
    .erase_sector = {{'0x%x' % algo.symbols['EraseSector']}},
    .program_page = {{'0x%x' % algo.symbols['ProgramPage']}},
    .static_base = {{'0x%x' % algo.rw_start}},
    .algo_blob = FLASH_ALGO
};

static const sector_info_t sectors_info[] = {
{%- for start, size  in algo.sector_sizes %}
    {{ "{0x%x, 0x%x}" % (start + algo.flash_start, size) }}, 
{%- endfor %}
};

static const flash_target_config_t flash_target_config = {
    .page_size  = {{'0x%x' % algo.page_size}},
    .flash_start = {{'0x%x' % algo.flash_start}},
    .flash_size = {{'0x%x' % algo.flash_size}},
    .sectors = sectors_info,
    .sector_info_count = sizeof(sectors_info) / sizeof(sector_info_t)
};

void flash_set_target_config(flash_t *obj)
{
    obj->flash_algo = &flash_algo_config;
    obj->target_config = &flash_target_config;
}

#endif