mirror of https://github.com/ARMmbed/mbed-os.git
Fix some issues with building on K64F, add K64F upload methods (#267)
* Fix some issues with building on K64F, add K64F upload methods * Add Mbed upload method * Fix pin validate test * Also install json5 * Fix incorrect COMPONENT_SD configpull/15510/head
parent
acfd341a16
commit
3fcfbbdb57
|
@ -193,6 +193,7 @@ jobs:
|
|||
name: validate pins
|
||||
run: |
|
||||
set -x
|
||||
python3 -m pip install json5
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
|
||||
| ( grep '.*[\\|\/]PinNames.h$' || true ) \
|
||||
|
|
|
@ -18,10 +18,8 @@ endmacro(create_mbed_802_15_4_target)
|
|||
|
||||
|
||||
if("Freescale" IN_LIST MBED_TARGET_LABELS)
|
||||
create_mbed_802_15_4_target()
|
||||
add_subdirectory(TARGET_Freescale)
|
||||
elseif("Silicon_Labs" IN_LIST MBED_TARGET_LABELS)
|
||||
create_mbed_802_15_4_target()
|
||||
add_subdirectory(TARGET_Silicon_Labs)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if("KW41Z" IN_LIST MBED_TARGET_LABELS)
|
||||
create_mbed_802_15_4_target()
|
||||
add_subdirectory(TARGET_KW41Z)
|
||||
endif()
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if("SL_RAIL" IN_LIST MBED_TARGET_LABELS)
|
||||
create_mbed_802_15_4_target()
|
||||
add_subdirectory(TARGET_SL_RAIL)
|
||||
endif()
|
||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import json5
|
||||
import pathlib
|
||||
import hashlib
|
||||
import re
|
||||
|
@ -26,6 +26,12 @@ from tabulate import tabulate
|
|||
from itertools import chain
|
||||
from enum import Enum
|
||||
|
||||
# Load targets data from JSON
|
||||
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
|
||||
with (
|
||||
mbed_os_root.joinpath("targets", "targets.json5")
|
||||
).open() as targets_json_file:
|
||||
target_data = json5.load(targets_json_file)
|
||||
|
||||
class ReturnCode(Enum):
|
||||
"""Return codes."""
|
||||
|
@ -76,11 +82,6 @@ def find_target_by_path(target_path):
|
|||
print("WARNING: MBED TARGET LIST marker invalid or not found in file " + target_path)
|
||||
print("Target could not be determined. Only the generic test suite will run. You can manually specify additional suites.")
|
||||
|
||||
with (
|
||||
mbed_os_root.joinpath("targets", "targets.json")
|
||||
).open() as targets_json_file:
|
||||
target_data = json.load(targets_json_file)
|
||||
|
||||
# find target in targets.json
|
||||
for target in target_data:
|
||||
if "public" in target_data[target]:
|
||||
|
@ -97,7 +98,6 @@ def find_target_by_path(target_path):
|
|||
|
||||
def find_target_by_name(target_name=""):
|
||||
"""Find a target by name."""
|
||||
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
|
||||
|
||||
targets = dict()
|
||||
|
||||
|
@ -133,15 +133,10 @@ def find_target_by_name(target_name=""):
|
|||
|
||||
def check_markers(test_mode=False):
|
||||
"""Validate markers in PinNames.h files"""
|
||||
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
|
||||
|
||||
|
||||
errors = []
|
||||
|
||||
with (
|
||||
mbed_os_root.joinpath("targets", "targets.json")
|
||||
).open() as targets_json_file:
|
||||
targets_json = json.load(targets_json_file)
|
||||
|
||||
if test_mode:
|
||||
search_dir = pathlib.Path(__file__).parent.joinpath('test_files').absolute()
|
||||
else:
|
||||
|
@ -187,8 +182,6 @@ def check_markers(test_mode=False):
|
|||
|
||||
def check_duplicate_pinnames_files(test_mode=False):
|
||||
"""Check for duplicate PinNames.h files"""
|
||||
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
|
||||
|
||||
errors = []
|
||||
|
||||
file_hash_dict = dict()
|
||||
|
@ -220,8 +213,6 @@ def check_duplicate_pinnames_files(test_mode=False):
|
|||
|
||||
def check_duplicate_markers(test_mode=False):
|
||||
"""Check target markers in PinNames.h files for duplicates."""
|
||||
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
|
||||
|
||||
errors = []
|
||||
|
||||
markers = dict()
|
||||
|
@ -262,13 +253,6 @@ def check_duplicate_markers(test_mode=False):
|
|||
|
||||
def target_has_form_factor(target_name, form_factor):
|
||||
"""Check if the target has the Arduino form factor."""
|
||||
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
|
||||
|
||||
with (
|
||||
mbed_os_root.joinpath("targets", "targets.json")
|
||||
).open() as targets_json_file:
|
||||
target_data = json.load(targets_json_file)
|
||||
|
||||
if target_name in target_data:
|
||||
if "supported_form_factors" in target_data[target_name]:
|
||||
form_factors = target_data[target_name]["supported_form_factors"]
|
||||
|
|
|
@ -57,10 +57,10 @@
|
|||
"SPI_CS": "PTD4"
|
||||
},
|
||||
"K64F": {
|
||||
"SPI_CS": "SPI_CS",
|
||||
"SPI_MOSI": "SPI_MOSI",
|
||||
"SPI_MISO": "SPI_MISO",
|
||||
"SPI_CLK": "SPI_SCK"
|
||||
"SPI_CS": "PTE4",
|
||||
"SPI_MOSI": "PTE3",
|
||||
"SPI_MISO": "PTE1",
|
||||
"SPI_CLK": "PTE2"
|
||||
},
|
||||
"K66F": {
|
||||
"SPI_MOSI": "PTE3",
|
||||
|
|
|
@ -262,17 +262,6 @@ typedef enum {
|
|||
#define BUTTON2 SW3
|
||||
|
||||
|
||||
// SPI Pins for SD card.
|
||||
// Note: They are different from the Arduino Uno SPI pins
|
||||
// (ARDUINO_UNO_SPI_xxx) for general purpose uses.
|
||||
// By default, Mbed OS maps those alias to Arduino Uno pins, but
|
||||
// for backward compatibility we map them to the SD card SPI.
|
||||
#define SPI_MOSI PTE3
|
||||
#define SPI_MISO PTE1
|
||||
#define SPI_SCK PTE2
|
||||
#define SPI_CS PTE4
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -42,4 +42,21 @@ extern uint32_t __VECTOR_RAM[];
|
|||
#define NVIC_NUM_VECTORS (16 + 86) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (__VECTOR_RAM) // Vectors positioned at start of RAM
|
||||
|
||||
#ifndef MBED_RAM_SIZE
|
||||
#define MBED_RAM_SIZE 0x30000
|
||||
#endif
|
||||
|
||||
#ifndef MBED_RAM_START
|
||||
#define MBED_RAM_START 0x20000000
|
||||
#endif
|
||||
|
||||
#ifndef MBED_RAM1_SIZE
|
||||
#define MBED_RAM1_SIZE 0x10000
|
||||
#endif
|
||||
|
||||
#ifndef MBED_RAM1_START
|
||||
#define MBED_RAM1_START 0x1FFF0000
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -361,7 +361,7 @@ static void spi_buffer_set(spi_t *obj, const void *tx, uint32_t tx_length, void
|
|||
bool spi_master_transfer(spi_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint8_t bit_width, uint32_t handler, uint32_t event, DMAUsage hint)
|
||||
{
|
||||
if (spi_active(obj)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check corner case */
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# Mbed OS upload method configuration file for target K64F.
|
||||
# To change any of these parameters from their default values, set them in your build script between where you
|
||||
# include app.cmake and where you add mbed os as a subdirectory.
|
||||
#
|
||||
# Notes:
|
||||
# 1. PyOCD did not actually work in my testing as of Apr 2024, though this device is supposed to be supported
|
||||
# 2. Be sure to update the DAPLink firmware on the board via these instructions: https://os.mbed.com/blog/entry/DAPLink-bootloader-update/
|
||||
|
||||
# General config parameters
|
||||
# -------------------------------------------------------------
|
||||
set(UPLOAD_METHOD_DEFAULT MBED)
|
||||
|
||||
# Config options for MBED
|
||||
# -------------------------------------------------------------
|
||||
|
||||
set(MBED_UPLOAD_ENABLED TRUE)
|
||||
set(MBED_RESET_BAUDRATE 115200)
|
||||
|
||||
# Config options for PYOCD
|
||||
# -------------------------------------------------------------
|
||||
set(PYOCD_UPLOAD_ENABLED TRUE)
|
||||
set(PYOCD_TARGET_NAME k64f)
|
||||
set(PYOCD_CLOCK_SPEED 4000k)
|
||||
|
||||
# Config options for OPENOCD
|
||||
# -------------------------------------------------------------
|
||||
|
||||
set(OPENOCD_UPLOAD_ENABLED TRUE)
|
||||
set(OPENOCD_CHIP_CONFIG_COMMANDS
|
||||
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/mk64f.cfg)
|
||||
|
||||
# Config options for LINKSERVER
|
||||
# -------------------------------------------------------------
|
||||
set(LINKSERVER_UPLOAD_ENABLED TRUE)
|
||||
set(LINKSERVER_DEVICE MK64FN1M0xxx12:FRDM-K64F)
|
|
@ -2,6 +2,9 @@
|
|||
# To change any of these parameters from their default values, set them in your build script between where you
|
||||
# include app.cmake and where you add mbed os as a subdirectory.
|
||||
|
||||
# Notes:
|
||||
# 1. LPC1768 is supposed to be supported by LinkServer, and I am able to get through flashing it, but it errors out at the end.
|
||||
|
||||
# General config parameters
|
||||
# -------------------------------------------------------------
|
||||
set(UPLOAD_METHOD_DEFAULT MBED)
|
||||
|
@ -33,3 +36,8 @@ set(MBED_RESET_BAUDRATE 115200)
|
|||
set(OPENOCD_UPLOAD_ENABLED TRUE)
|
||||
set(OPENOCD_CHIP_CONFIG_COMMANDS
|
||||
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/lpc1768.cfg)
|
||||
|
||||
# Config options for LINKSERVER
|
||||
# -------------------------------------------------------------
|
||||
set(LINKSERVER_UPLOAD_ENABLED TRUE)
|
||||
set(LINKSERVER_DEVICE LPC1768)
|
|
@ -0,0 +1,9 @@
|
|||
# OpenOCD config file for Kinetis K64F chips using DAPLink
|
||||
|
||||
source [find interface/cmsis-dap.cfg]
|
||||
|
||||
transport select swd
|
||||
|
||||
source [find target/k60.cfg]
|
||||
|
||||
reset_config srst_only
|
|
@ -19,7 +19,7 @@ set(UPLOAD_PYOCD_FOUND ${HAVE_PYOCD})
|
|||
set(PYOCD_PROBE_UID "" CACHE STRING "Probe UID to pass to pyOCD commands. You can get the UIDs from `python -m pyocd list`. Set to empty to detect any probe.")
|
||||
|
||||
### Function to generate upload target
|
||||
set(PYOCD_PROBE_ARGS "")
|
||||
set(PYOCD_PROBE_ARGS "" CACHE INTERNAL "" FORCE)
|
||||
if(NOT "${PYOCD_PROBE_UID}" STREQUAL "")
|
||||
set(PYOCD_PROBE_ARGS --probe ${PYOCD_PROBE_UID} CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue