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