Skip to content

Commit

Permalink
Add support for NUCLEO-WB55 and DISCO-L475VG-IOT01A (fixes #1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-arm committed Feb 13, 2024
2 parents bbb5228 + 5b9d7de commit dbd02db
Show file tree
Hide file tree
Showing 12 changed files with 368 additions and 10 deletions.
9 changes: 6 additions & 3 deletions docs/PORT_BOARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This assumes there is already target support present in the codebase. If adding
* @brief board_info api for my board
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2021, Arm Limited, All Rights Reserved
* Copyright (c) 2009-2023, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
Expand All @@ -49,10 +49,13 @@ This assumes there is already target support present in the codebase. If adding
extern target_cfg_t target_device_nrf51822_16;
const board_info_t g_board_info = {
.board_id = "0x240",
.family_id = kStub_HWReset_FamilyID,
.info_version = kBoardInfoVersion,
.board_id = "9999",
.family_id = kNordic_Nrf51_FamilyID,
.flags = kEnablePageErase|kEnableUnderResetConnect,
.target_cfg = &target_device_nrf51822_16,
.board_vendor = "Vendor Name",
.board_name = "My Board Name",
};
```
The complete fields of board_info api with description is in `source/target/target_board.h`.
Expand Down
10 changes: 6 additions & 4 deletions docs/PORT_TARGET_FAMILY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Adding new target family support requires creating a flash algo blob and the imp
* @brief Target reset for the new target
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* Copyright (c) 2009-2023, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
Expand Down Expand Up @@ -70,15 +70,15 @@ const target_family_descriptor_t g_target_family = {
The target family api is located in `source/target/target_family.h` and target_reset file can customize the function apis according to the family specification. Family id is a combination of vendor id and an incrementing id. There are predefined family id stubs that can be used for generic reset types; `kStub_HWReset_FamilyID`, `kStub_SWVectReset_FamilyID`, and `kStub_SWSysReset_FamilyID`.
A flash algorithm blob is needed to program the target MCUs internal (or external) flash memory. This blob contains position independent functions for erasing, reading and writing to the flash controller. Flash algorithm blobs are created from the [FlashAlgo project.](https://github.com/pyocd/FlashAlgo). An example blob is shown below and would be added to `source/family/<mfg>/<targetname>/flash_blob.c`
A flash algorithm blob is needed to program the target MCUs internal (or external) flash memory. This blob contains position independent functions for erasing, reading and writing to the flash controller. Flash algorithm blobs are created from the [FlashAlgo project.](https://github.com/pyocd/FlashAlgo). Use the `tools/generate_flash_algo.py` script to generate the `flash_blob.c` source file for the target (use the `--pack-path` if the flash algo originates from a CMSIS Pack). An example blob is shown below and would be added to `source/family/<mfg>/<targetname>/flash_blob.c`:
```c
/**
* @file flash_blob.c
* @brief Flash algorithm for the new target MCU
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* Copyright (c) 2009-2023, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
Expand Down Expand Up @@ -144,7 +144,7 @@ The last required file is the target MCU description file `source/family/<mfg>/<
* @brief Target information for the target MCU
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* Copyright (c) 2009-2023, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
Expand Down Expand Up @@ -175,6 +175,8 @@ target_cfg_t target_device = {
.flash_regions[0].flash_algo = (program_target_t *) &flash,
.ram_regions[0].start = 0x1fff0000,
.ram_regions[0].end = 0x20030000,
.target_vendor = "NXP",
.target_part_number = "MK66FN2M0VMD18",
};
```

Expand Down
8 changes: 8 additions & 0 deletions projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,10 @@ projects:
- *module_if
- *module_hic_stm32f103xb
- records/board/stm32f746zg.yaml
stm32f103xb_stm32l475vg_if:
- *module_if
- *module_hic_stm32f103xb
- records/board/stm32l475vg.yaml
stm32f103xb_stm32l476rg_if:
- *module_if
- *module_hic_stm32f103xb
Expand All @@ -661,6 +665,10 @@ projects:
- *module_if
- *module_hic_stm32f103xb
- records/board/ublox_evk_odin_w2.yaml
stm32f103xb_stm32wb55rg_if:
- *module_if
- *module_hic_stm32f103xb
- records/board/stm32wb55.yaml
stm32h743xx_udb_bl:
- *stm32h743xx_bl
- records/board/stm32h743xx_udb_bl.yaml
Expand Down
8 changes: 8 additions & 0 deletions records/board/stm32l475vg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
common:
macros:
- USB_PROD_STR="STM32L475 CMSIS-DAP"
sources:
board:
- source/board/stm32l475vg.c
family:
- source/family/st/stm32l475vg/target.c
8 changes: 8 additions & 0 deletions records/board/stm32wb55.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
common:
macros:
- USB_PROD_STR="STM32WB55 CMSIS-DAP"
sources:
board:
- source/board/stm32wb55rg.c
family:
- source/family/st/stm32wb55rg/target.c
33 changes: 33 additions & 0 deletions source/board/stm32l475vg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file stm32l475vg.c
* @brief board ID for the B-L475E-IOT01A board
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2023, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* 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 "target_family.h"
#include "target_board.h"

const board_info_t g_board_info = {
.info_version = kBoardInfoVersion,
.board_id = "0764",
.family_id = kStub_HWReset_FamilyID,
.daplink_drive_name = "DIS_L4IOT ",
.target_cfg = &target_device,
.board_vendor = "STMicroelectronics",
.board_name = "B-L475E-IOT01A", // DISCO-L475VG-IOT01A
};
32 changes: 32 additions & 0 deletions source/board/stm32wb55rg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @file stm32wb55rg.c
* @brief board ID for the NUCLEO-WB55 board
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2023, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* 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 "target_family.h"
#include "target_board.h"

const board_info_t g_board_info = {
.info_version = kBoardInfoVersion,
.board_id = "0839",
.family_id = kStub_HWReset_FamilyID,
.target_cfg = &target_device,
.board_vendor = "STMicroelectronics",
.board_name = "NUCLEO-WB55",
};
91 changes: 91 additions & 0 deletions source/family/st/stm32l475vg/flash_blob.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* Flash algorithm for STM32L4xx 1MB Flash
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2023 Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/

// Generated from 'STM32L4xx_1024.FLM' (STM32L4xx 1MB Flash)
// Originating from 'Keil.STM32L4xx_DFP.2.6.1.pack'
// digest = 653d7ff5bb73c3a78605010dc6484e06e05d8901873b0eb5c7a8fa14ab4e2917, file size = 15840
// algo version = 0x101, algo size = 552 (0x228)
static const uint32_t STM32L4xx_1024_flash_prog_blob[] = {
0xe7fdbe00,
0x8f4ff3bf, 0x487a4770, 0x497a6800, 0x0d000500, 0xd0051840, 0xd003282d, 0xd001282f, 0x47702001,
0x47702000, 0x6a004874, 0x0fc00280, 0xb5004770, 0xf7ff4602, 0x2801ffe8, 0xf7ffd108, 0x2801fff3,
0x486ed104, 0xd3014282, 0xbd002001, 0xbd002000, 0x4602b500, 0xffd7f7ff, 0xd0022801, 0x0d8002d0,
0x4967bd00, 0x40080ad0, 0xd5f90311, 0x300130ff, 0x4861bd00, 0x60814963, 0x60814963, 0x60012100,
0x61014962, 0x03c06a00, 0x4862d406, 0x60014960, 0x60412106, 0x60814960, 0x47702000, 0x49562001,
0x614807c0, 0x47702000, 0x47702001, 0x49574852, 0x13c16101, 0x69416141, 0x04122201, 0x61414311,
0x4a544956, 0x6011e000, 0x03db6903, 0x2100d4fb, 0x46086141, 0xb5104770, 0xf7ff4604, 0x4603ffa8,
0xf7ff4620, 0x4944ffb5, 0x610c4c48, 0x02d800c2, 0x43021c92, 0x6948614a, 0x04122201, 0x61484310,
0x8f4ff3bf, 0x4a434845, 0x6010e000, 0x03db690b, 0x2000d4fb, 0x69086148, 0xd0014020, 0x2001610c,
0xb5f0bd10, 0xb0884b34, 0x611c4c38, 0x615c2400, 0xe059466e, 0x24014b30, 0x2908615c, 0x6813d315,
0x68536003, 0xf3bf6043, 0x4c348f4f, 0x4b2a4d31, 0x602ce000, 0x03ff691f, 0x691bd4fb, 0x42234c2b,
0x3008d13c, 0x32083908, 0x2300e03e, 0x7814e004, 0x1c52009d, 0x1c5b5174, 0xd3f8428b, 0x24ff2300,
0x1a6d2508, 0x185fe003, 0x51f400bf, 0x429d1c5b, 0x9b01d8f9, 0x021b9900, 0x990218cb, 0x04099c03,
0x19090624, 0x91001859, 0x99049b05, 0x18c9021b, 0x9c079b06, 0x0624041b, 0x18c9191b, 0x99009101,
0x99016001, 0xf3bf6041, 0x4b0b8f4f, 0x691c2100, 0xd4fc03e4, 0x4c0d691b, 0xd0054223, 0x480b4906,
0x20016108, 0xbdf0b008, 0xd1a32900, 0xe7f92000, 0xe0042000, 0xfffffbcb, 0x40022000, 0x08080000,
0x000002ff, 0x45670123, 0xcdef89ab, 0x0000c3fa, 0x00005555, 0x40003000, 0x00000fff, 0x0000aaaa,
0x00000000
};

// Start address of flash
static const uint32_t flash_start = 0x08000000;
// Size of flash
static const uint32_t flash_size = 0x00100000;

/**
* List of start and size for each size of flash sector - even indexes are start, odd are size
* The size will apply to all sectors between the listed address and the next address
* in the list.
* The last pair in the list will have sectors starting at that address and ending
* at address flash_start + flash_size.
*/
static const sector_info_t sectors_info[] = {
{0x08000000, 0x00000800},
};

static const program_target_t flash = {
0x20000077, // Init
0x200000a1, // UnInit
0x200000b1, // EraseChip
0x200000db, // EraseSector
0x20000127, // ProgramPage
0x00000000, // Verify

// BKPT : start of blob + 1
// RSB : blob start + header + rw data offset
// RSP : stack pointer
{
0x20000001,
0x20000224,
0x20000c00
},

// mem buffer location
0x20000c00,
// location to write prog_blob in target RAM
0x20000000,
// prog_blob size
sizeof(STM32L4xx_1024_flash_prog_blob),
// address of prog_blob
STM32L4xx_1024_flash_prog_blob,
// ram_to_flash_bytes_to_be_written
0x00000400,
// algo_flags (combination of kAlgoVerifyReturnsAddress, kAlgoSingleInitType and kAlgoSkipChipErase)
0x00000000
};
39 changes: 39 additions & 0 deletions source/family/st/stm32l475vg/target.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* @file target.c
* @brief Target information for the stm32l486jg
*
* DAPLink Interface Firmware
* Copyright (c) 2017-2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* 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 "target_config.h"

// The file flash_blob.c must only be included in target.c
#include "flash_blob.c"

// target information
target_cfg_t target_device = {
.sectors_info = sectors_info,
.sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)),
.flash_regions[0].start = 0x08000000,
.flash_regions[0].end = 0x08100000,
.flash_regions[0].flags = kRegionIsDefault,
.flash_regions[0].flash_algo = (program_target_t *) &flash,
.ram_regions[0].start = 0x20000000,
.ram_regions[0].end = 0x20000000 + 0x00018000,
.target_vendor = "STMicroelectronics",
.target_part_number = "STM32L475VGTx",
};
Loading

0 comments on commit dbd02db

Please sign in to comment.