From 92533c3eef4264191efd5919c04fa67e515a41b2 Mon Sep 17 00:00:00 2001 From: Jonathan BAUDIN Date: Wed, 21 Jul 2021 18:28:47 +0200 Subject: [PATCH 1/7] stm32l475vg_if: Add support for B-L475E-IOT01A --- projects.yaml | 4 ++ records/board/stm32l475vg.yaml | 8 +++ source/board/stm32l475vg.c | 31 +++++++++ source/family/st/stm32l475vg/flash_blob.c | 77 +++++++++++++++++++++++ source/family/st/stm32l475vg/target.c | 38 +++++++++++ 5 files changed, 158 insertions(+) create mode 100644 records/board/stm32l475vg.yaml create mode 100644 source/board/stm32l475vg.c create mode 100644 source/family/st/stm32l475vg/flash_blob.c create mode 100644 source/family/st/stm32l475vg/target.c diff --git a/projects.yaml b/projects.yaml index 418c762e6e..5060c9dfce 100644 --- a/projects.yaml +++ b/projects.yaml @@ -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 diff --git a/records/board/stm32l475vg.yaml b/records/board/stm32l475vg.yaml new file mode 100644 index 0000000000..93daaf0f03 --- /dev/null +++ b/records/board/stm32l475vg.yaml @@ -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 diff --git a/source/board/stm32l475vg.c b/source/board/stm32l475vg.c new file mode 100644 index 0000000000..6566290971 --- /dev/null +++ b/source/board/stm32l475vg.c @@ -0,0 +1,31 @@ +/** + * @file stm32f103rb.c + * @brief board ID for the STM32 NUCLEO-F103RB board + * + * DAPLink Interface Firmware + * Copyright (c) 2009-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_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, +}; diff --git a/source/family/st/stm32l475vg/flash_blob.c b/source/family/st/stm32l475vg/flash_blob.c new file mode 100644 index 0000000000..1e53ac07c9 --- /dev/null +++ b/source/family/st/stm32l475vg/flash_blob.c @@ -0,0 +1,77 @@ +/* Flash OS Routines (Automagically Generated) + * Copyright (c) 2009-2019ARM 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. + */ + +static const uint32_t stm32l475_flash_prog_blob[] = { + 0xE00ABE00, + 0xb085b480, 0x6078af00, 0xf103687b, 0x60fb4378, 0x0adb68fb, 0x37144618, 0xbc8046bd, 0x00004770, + 0xb085b480, 0x60f8af00, 0x607a60b9, 0x4a124b11, 0x4b10609a, 0x609a4a11, 0x691b4b0e, 0xf0434a0d, + 0x611303b8, 0x69db4b0b, 0x0320f003, 0xd10a2b00, 0xf2454b0b, 0x601a5255, 0x22064b09, 0x4b08605a, + 0x72fff640, 0x2300609a, 0x37144618, 0xbc8046bd, 0xbf004770, 0x40022000, 0x45670123, 0xcdef89ab, + 0x40003000, 0xb085b480, 0x6078af00, 0x681b4b0b, 0x4a0a60fb, 0xf42368fb, 0x601353f8, 0x68fb4a07, + 0x4b066013, 0x4a05695b, 0x4300f043, 0x23006153, 0x37144618, 0xbc8046bd, 0xbf004770, 0x40022000, + 0xaf00b480, 0x695b4b10, 0xf0434a0f, 0x61530304, 0x695b4b0d, 0xf4434a0c, 0x61533380, 0x4b0be003, + 0x22aaf64a, 0x4b08601a, 0xf403691b, 0x2b003380, 0x4b05d1f5, 0x4a04695b, 0x0304f023, 0x23006153, + 0x46bd4618, 0x4770bc80, 0x40022000, 0x40003000, 0xb084b580, 0x6078af00, 0xf7ff6878, 0x60f8ff71, + 0x691b4b1d, 0xf0434a1c, 0x611303b8, 0x22024b1a, 0x4b19615a, 0x68fb695a, 0xf40300db, 0x491663ff, + 0x614b4313, 0x695b4b14, 0xf4434a13, 0x61533380, 0x4b12e003, 0x22aaf64a, 0x4b0f601a, 0xf403691b, + 0x2b003380, 0x4b0cd1f5, 0x4a0b695b, 0x0302f023, 0x4b096153, 0xf003691b, 0x2b0003b8, 0x4b06d007, + 0x4a05691b, 0x03b8f043, 0x23016113, 0x2300e000, 0x37104618, 0xbd8046bd, 0x40022000, 0x40003000, + 0xb085b480, 0x60f8af00, 0x607a60b9, 0x330368bb, 0x0303f023, 0x4b2160bb, 0x4a20691b, 0x03b8f043, + 0x4b1e6113, 0x615a2200, 0x4b1ce02f, 0x4a1b695b, 0x7300f443, 0x0301f043, 0x68fb6153, 0x6812687a, + 0xbf00601a, 0x691b4b15, 0x3380f403, 0xd1f92b00, 0x695b4b12, 0xf0234a11, 0x61530301, 0x691b4b0f, + 0x03b8f003, 0xd0072b00, 0x691b4b0c, 0xf0434a0b, 0x611303b8, 0xe00c2301, 0x330468fb, 0x687b60fb, + 0x607b3304, 0x3b0468bb, 0x68bb60bb, 0xd1cc2b00, 0x46182300, 0x46bd3714, 0x4770bc80, 0x40022000 +}; + +// 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 = { + 0x20000025, // Init + 0x20000089, // UnInit + 0x200000c5, // EraseChip + 0x20000115, // EraseSector + 0x200001a5, // ProgramPage + 0x0, // Verify + + // BKPT : start of blob + 1 + // RSB : blob start + header + rw data offset + // RSP : stack pointer + { + 0x20000001, + 0x20000244, + 0x20000500 + }, + + 0x20000000 + 0x00000A00, // mem buffer location + 0x20000000, // location to write prog_blob in target RAM + sizeof(stm32l475_flash_prog_blob), // prog_blob size + stm32l475_flash_prog_blob, // address of prog_blob + 0x00000400 // ram_to_flash_bytes_to_be_written +}; \ No newline at end of file diff --git a/source/family/st/stm32l475vg/target.c b/source/family/st/stm32l475vg/target.c new file mode 100644 index 0000000000..094a8f2834 --- /dev/null +++ b/source/family/st/stm32l475vg/target.c @@ -0,0 +1,38 @@ +/** + * @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, + //.erase_reset = 1, +}; From 7f535f16447f0ed65eaea7d987ae7232df00af2a Mon Sep 17 00:00:00 2001 From: Jonathan BAUDIN Date: Mon, 21 Mar 2022 15:20:17 +0100 Subject: [PATCH 2/7] stm32l475vg_if: Upgrade STM32L475VG Flash Algo --- source/family/st/stm32l475vg/flash_blob.c | 34 +++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/source/family/st/stm32l475vg/flash_blob.c b/source/family/st/stm32l475vg/flash_blob.c index 1e53ac07c9..43473b8a82 100644 --- a/source/family/st/stm32l475vg/flash_blob.c +++ b/source/family/st/stm32l475vg/flash_blob.c @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - static const uint32_t stm32l475_flash_prog_blob[] = { 0xE00ABE00, 0xb085b480, 0x6078af00, 0xf103687b, 0x60fb4378, 0x0adb68fb, 0x37144618, 0xbc8046bd, 0x00004770, @@ -22,18 +21,19 @@ static const uint32_t stm32l475_flash_prog_blob[] = { 0x72fff640, 0x2300609a, 0x37144618, 0xbc8046bd, 0xbf004770, 0x40022000, 0x45670123, 0xcdef89ab, 0x40003000, 0xb085b480, 0x6078af00, 0x681b4b0b, 0x4a0a60fb, 0xf42368fb, 0x601353f8, 0x68fb4a07, 0x4b066013, 0x4a05695b, 0x4300f043, 0x23006153, 0x37144618, 0xbc8046bd, 0xbf004770, 0x40022000, - 0xaf00b480, 0x695b4b10, 0xf0434a0f, 0x61530304, 0x695b4b0d, 0xf4434a0c, 0x61533380, 0x4b0be003, - 0x22aaf64a, 0x4b08601a, 0xf403691b, 0x2b003380, 0x4b05d1f5, 0x4a04695b, 0x0304f023, 0x23006153, - 0x46bd4618, 0x4770bc80, 0x40022000, 0x40003000, 0xb084b580, 0x6078af00, 0xf7ff6878, 0x60f8ff71, - 0x691b4b1d, 0xf0434a1c, 0x611303b8, 0x22024b1a, 0x4b19615a, 0x68fb695a, 0xf40300db, 0x491663ff, - 0x614b4313, 0x695b4b14, 0xf4434a13, 0x61533380, 0x4b12e003, 0x22aaf64a, 0x4b0f601a, 0xf403691b, - 0x2b003380, 0x4b0cd1f5, 0x4a0b695b, 0x0302f023, 0x4b096153, 0xf003691b, 0x2b0003b8, 0x4b06d007, - 0x4a05691b, 0x03b8f043, 0x23016113, 0x2300e000, 0x37104618, 0xbd8046bd, 0x40022000, 0x40003000, - 0xb085b480, 0x60f8af00, 0x607a60b9, 0x330368bb, 0x0303f023, 0x4b2160bb, 0x4a20691b, 0x03b8f043, - 0x4b1e6113, 0x615a2200, 0x4b1ce02f, 0x4a1b695b, 0x7300f443, 0x0301f043, 0x68fb6153, 0x6812687a, - 0xbf00601a, 0x691b4b15, 0x3380f403, 0xd1f92b00, 0x695b4b12, 0xf0234a11, 0x61530301, 0x691b4b0f, - 0x03b8f003, 0xd0072b00, 0x691b4b0c, 0xf0434a0b, 0x611303b8, 0xe00c2301, 0x330468fb, 0x687b60fb, - 0x607b3304, 0x3b0468bb, 0x68bb60bb, 0xd1cc2b00, 0x46182300, 0x46bd3714, 0x4770bc80, 0x40022000 + 0xaf00b480, 0x695b4b16, 0xf0434a15, 0x61530304, 0x695b4b13, 0xf4434a12, 0x61534300, 0x695b4b10, + 0xf4434a0f, 0x61533380, 0x4b0ee003, 0x22aaf64a, 0x4b0b601a, 0xf403691b, 0x2b003380, 0x4b08d1f5, + 0x4a07695b, 0x0304f023, 0x4b056153, 0x4a04695b, 0x4300f423, 0x23006153, 0x46bd4618, 0x4770bc80, + 0x40022000, 0x40003000, 0xb084b580, 0x6078af00, 0xf7ff6878, 0x60f8ff65, 0x691b4b1d, 0xf0434a1c, + 0x611303b8, 0x22024b1a, 0x4b19615a, 0x68fb695a, 0xf40300db, 0x491663ff, 0x614b4313, 0x695b4b14, + 0xf4434a13, 0x61533380, 0x4b12e003, 0x22aaf64a, 0x4b0f601a, 0xf403691b, 0x2b003380, 0x4b0cd1f5, + 0x4a0b695b, 0x0302f023, 0x4b096153, 0xf003691b, 0x2b0003b8, 0x4b06d007, 0x4a05691b, 0x03b8f043, + 0x23016113, 0x2300e000, 0x37104618, 0xbd8046bd, 0x40022000, 0x40003000, 0xb085b480, 0x60f8af00, + 0x607a60b9, 0x330368bb, 0x0303f023, 0x4b2160bb, 0x4a20691b, 0x03b8f043, 0x4b1e6113, 0x615a2200, + 0x4b1ce02f, 0x4a1b695b, 0x7300f443, 0x0301f043, 0x68fb6153, 0x6812687a, 0xbf00601a, 0x691b4b15, + 0x3380f403, 0xd1f92b00, 0x695b4b12, 0xf0234a11, 0x61530301, 0x691b4b0f, 0x03b8f003, 0xd0072b00, + 0x691b4b0c, 0xf0434a0b, 0x611303b8, 0xe00c2301, 0x330468fb, 0x687b60fb, 0x607b3304, 0x3b0468bb, + 0x68bb60bb, 0xd1cc2b00, 0x46182300, 0x46bd3714, 0x4770bc80, 0x40022000, 0x00000000, 0x00000000 }; // Start address of flash @@ -56,8 +56,8 @@ static const program_target_t flash = { 0x20000025, // Init 0x20000089, // UnInit 0x200000c5, // EraseChip - 0x20000115, // EraseSector - 0x200001a5, // ProgramPage + 0x2000012d, // EraseSector + 0x200001bd, // ProgramPage 0x0, // Verify // BKPT : start of blob + 1 @@ -65,7 +65,7 @@ static const program_target_t flash = { // RSP : stack pointer { 0x20000001, - 0x20000244, + 0x20000264, 0x20000500 }, @@ -73,5 +73,5 @@ static const program_target_t flash = { 0x20000000, // location to write prog_blob in target RAM sizeof(stm32l475_flash_prog_blob), // prog_blob size stm32l475_flash_prog_blob, // address of prog_blob - 0x00000400 // ram_to_flash_bytes_to_be_written + 0x00000800 // ram_to_flash_bytes_to_be_written }; \ No newline at end of file From 94a979ee23bcd2f3fe84739155851d2b9e4ff13d Mon Sep 17 00:00:00 2001 From: Mathias Brossard Date: Sat, 23 Sep 2023 14:48:20 -0500 Subject: [PATCH 3/7] stm32l475vg_if: B-L475E-IOT01A board updates Add CMSIS-DAP 2.1 new fields and update flash algo --- source/board/stm32l475vg.c | 10 ++- source/family/st/stm32l475vg/flash_blob.c | 90 +++++++++++++---------- source/family/st/stm32l475vg/target.c | 5 +- 3 files changed, 61 insertions(+), 44 deletions(-) diff --git a/source/board/stm32l475vg.c b/source/board/stm32l475vg.c index 6566290971..741739b541 100644 --- a/source/board/stm32l475vg.c +++ b/source/board/stm32l475vg.c @@ -1,9 +1,9 @@ /** - * @file stm32f103rb.c - * @brief board ID for the STM32 NUCLEO-F103RB board + * @file stm32l475vg.c + * @brief board ID for the B-L475E-IOT01A board * * DAPLink Interface Firmware - * Copyright (c) 2009-2019, 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 @@ -26,6 +26,8 @@ const board_info_t g_board_info = { .info_version = kBoardInfoVersion, .board_id = "0764", .family_id = kStub_HWReset_FamilyID, - .daplink_drive_name = "DIS_L4IOT ", + .daplink_drive_name = "DIS_L4IOT ", .target_cfg = &target_device, + .board_vendor = "STMicroelectronics", + .board_name = "B-L475E-IOT01A", // DISCO-L475VG-IOT01A }; diff --git a/source/family/st/stm32l475vg/flash_blob.c b/source/family/st/stm32l475vg/flash_blob.c index 43473b8a82..50bb6e9b74 100644 --- a/source/family/st/stm32l475vg/flash_blob.c +++ b/source/family/st/stm32l475vg/flash_blob.c @@ -1,5 +1,8 @@ -/* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2019ARM Limited +/* 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. @@ -13,27 +16,31 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -static const uint32_t stm32l475_flash_prog_blob[] = { - 0xE00ABE00, - 0xb085b480, 0x6078af00, 0xf103687b, 0x60fb4378, 0x0adb68fb, 0x37144618, 0xbc8046bd, 0x00004770, - 0xb085b480, 0x60f8af00, 0x607a60b9, 0x4a124b11, 0x4b10609a, 0x609a4a11, 0x691b4b0e, 0xf0434a0d, - 0x611303b8, 0x69db4b0b, 0x0320f003, 0xd10a2b00, 0xf2454b0b, 0x601a5255, 0x22064b09, 0x4b08605a, - 0x72fff640, 0x2300609a, 0x37144618, 0xbc8046bd, 0xbf004770, 0x40022000, 0x45670123, 0xcdef89ab, - 0x40003000, 0xb085b480, 0x6078af00, 0x681b4b0b, 0x4a0a60fb, 0xf42368fb, 0x601353f8, 0x68fb4a07, - 0x4b066013, 0x4a05695b, 0x4300f043, 0x23006153, 0x37144618, 0xbc8046bd, 0xbf004770, 0x40022000, - 0xaf00b480, 0x695b4b16, 0xf0434a15, 0x61530304, 0x695b4b13, 0xf4434a12, 0x61534300, 0x695b4b10, - 0xf4434a0f, 0x61533380, 0x4b0ee003, 0x22aaf64a, 0x4b0b601a, 0xf403691b, 0x2b003380, 0x4b08d1f5, - 0x4a07695b, 0x0304f023, 0x4b056153, 0x4a04695b, 0x4300f423, 0x23006153, 0x46bd4618, 0x4770bc80, - 0x40022000, 0x40003000, 0xb084b580, 0x6078af00, 0xf7ff6878, 0x60f8ff65, 0x691b4b1d, 0xf0434a1c, - 0x611303b8, 0x22024b1a, 0x4b19615a, 0x68fb695a, 0xf40300db, 0x491663ff, 0x614b4313, 0x695b4b14, - 0xf4434a13, 0x61533380, 0x4b12e003, 0x22aaf64a, 0x4b0f601a, 0xf403691b, 0x2b003380, 0x4b0cd1f5, - 0x4a0b695b, 0x0302f023, 0x4b096153, 0xf003691b, 0x2b0003b8, 0x4b06d007, 0x4a05691b, 0x03b8f043, - 0x23016113, 0x2300e000, 0x37104618, 0xbd8046bd, 0x40022000, 0x40003000, 0xb085b480, 0x60f8af00, - 0x607a60b9, 0x330368bb, 0x0303f023, 0x4b2160bb, 0x4a20691b, 0x03b8f043, 0x4b1e6113, 0x615a2200, - 0x4b1ce02f, 0x4a1b695b, 0x7300f443, 0x0301f043, 0x68fb6153, 0x6812687a, 0xbf00601a, 0x691b4b15, - 0x3380f403, 0xd1f92b00, 0x695b4b12, 0xf0234a11, 0x61530301, 0x691b4b0f, 0x03b8f003, 0xd0072b00, - 0x691b4b0c, 0xf0434a0b, 0x611303b8, 0xe00c2301, 0x330468fb, 0x687b60fb, 0x607b3304, 0x3b0468bb, - 0x68bb60bb, 0xd1cc2b00, 0x46182300, 0x46bd3714, 0x4770bc80, 0x40022000, 0x00000000, 0x00000000 + +// 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 @@ -49,29 +56,36 @@ static const uint32_t flash_size = 0x00100000; * at address flash_start + flash_size. */ static const sector_info_t sectors_info[] = { - 0x08000000, 0x00000800, + {0x08000000, 0x00000800}, }; static const program_target_t flash = { - 0x20000025, // Init - 0x20000089, // UnInit - 0x200000c5, // EraseChip - 0x2000012d, // EraseSector - 0x200001bd, // ProgramPage - 0x0, // Verify + 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, - 0x20000264, - 0x20000500 + 0x20000224, + 0x20000c00 }, - 0x20000000 + 0x00000A00, // mem buffer location - 0x20000000, // location to write prog_blob in target RAM - sizeof(stm32l475_flash_prog_blob), // prog_blob size - stm32l475_flash_prog_blob, // address of prog_blob - 0x00000800 // ram_to_flash_bytes_to_be_written -}; \ No newline at end of file + // 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 +}; diff --git a/source/family/st/stm32l475vg/target.c b/source/family/st/stm32l475vg/target.c index 094a8f2834..37f67df58b 100644 --- a/source/family/st/stm32l475vg/target.c +++ b/source/family/st/stm32l475vg/target.c @@ -31,8 +31,9 @@ target_cfg_t target_device = { .flash_regions[0].start = 0x08000000, .flash_regions[0].end = 0x08100000, .flash_regions[0].flags = kRegionIsDefault, - .flash_regions[0].flash_algo = (program_target_t *) &flash, + .flash_regions[0].flash_algo = (program_target_t *) &flash, .ram_regions[0].start = 0x20000000, .ram_regions[0].end = 0x20000000 + 0x00018000, - //.erase_reset = 1, + .target_vendor = "STMicroelectronics", + .target_part_number = "STM32L475VGTx", }; From 998fa5de9eaf8d22446dda5814bde6673c960dbb Mon Sep 17 00:00:00 2001 From: Jonathan BAUDIN Date: Wed, 21 Jul 2021 18:29:18 +0200 Subject: [PATCH 4/7] stm32wb55rg_if: Add support for NUCLEO-WB55 board --- projects.yaml | 4 ++ records/board/stm32wb55.yaml | 8 +++ source/board/stm32wb55rg.c | 30 ++++++++ source/family/st/stm32wb55rg/flash_blob.c | 85 +++++++++++++++++++++++ source/family/st/stm32wb55rg/target.c | 38 ++++++++++ 5 files changed, 165 insertions(+) create mode 100644 records/board/stm32wb55.yaml create mode 100644 source/board/stm32wb55rg.c create mode 100644 source/family/st/stm32wb55rg/flash_blob.c create mode 100644 source/family/st/stm32wb55rg/target.c diff --git a/projects.yaml b/projects.yaml index 5060c9dfce..710aa6ff43 100644 --- a/projects.yaml +++ b/projects.yaml @@ -665,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 diff --git a/records/board/stm32wb55.yaml b/records/board/stm32wb55.yaml new file mode 100644 index 0000000000..61cea558da --- /dev/null +++ b/records/board/stm32wb55.yaml @@ -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 diff --git a/source/board/stm32wb55rg.c b/source/board/stm32wb55rg.c new file mode 100644 index 0000000000..e3919f0559 --- /dev/null +++ b/source/board/stm32wb55rg.c @@ -0,0 +1,30 @@ +/** + * @file stm32wb55rg.c + * @brief board ID for the STM32WB55 board + * + * DAPLink Interface Firmware + * Copyright (c) 2009-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_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, +}; diff --git a/source/family/st/stm32wb55rg/flash_blob.c b/source/family/st/stm32wb55rg/flash_blob.c new file mode 100644 index 0000000000..0d4bdbbe87 --- /dev/null +++ b/source/family/st/stm32wb55rg/flash_blob.c @@ -0,0 +1,85 @@ +/* Flash OS Routines (Automagically Generated) + * Copyright (c) 2009-2019ARM 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. + */ + +static const uint32_t stm32wb55_flash_prog_blob[] = { + 0xE00ABE00, + 0xb085b480, 0x6078af00, 0xf103687b, 0x60fb4378, 0x0b1b68fb, 0x37144618, 0xbc8046bd, 0x00004770, + 0xaf00b480, 0x4b05bf00, 0xf403691b, 0x2b003380, 0xbf00d1f9, 0x46bdbf00, 0x4770bc80, 0x58004000, + 0xaf00b480, 0x4b05bf00, 0xf403691b, 0x2b002300, 0xbf00d1f9, 0x46bdbf00, 0x4770bc80, 0x58004000, + 0xb083b480, 0x4b08af00, 0x3080f8d3, 0x607bb2db, 0x031b687b, 0x687b607b, 0x6300f103, 0x370c4618, + 0xbc8046bd, 0xbf004770, 0x58004000, 0xb085b480, 0x60f8af00, 0x2300e9c7, 0x683a68fb, 0xf3bf601a, + 0xbf008f6f, 0x0100e9d7, 0x0200f04f, 0x0300f04f, 0x2300000a, 0x310468f9, 0x600b4613, 0x3714bf00, + 0xbc8046bd, 0x00004770, 0xb085b480, 0x60f8af00, 0x607a60b9, 0x695b4b0a, 0xda052b00, 0x4a094b08, + 0x4b07609a, 0x609a4a08, 0x691b4b05, 0xf0434a04, 0x611303b8, 0x46182300, 0x46bd3714, 0x4770bc80, + 0x58004000, 0x45670123, 0xcdef89ab, 0xb085b480, 0x6078af00, 0x681b4b0b, 0x4a0a60fb, 0xf42368fb, + 0x601353f8, 0x68fb4a07, 0x4b066013, 0x4a05695b, 0x4300f043, 0x23006153, 0x37144618, 0xbc8046bd, + 0xbf004770, 0x58004000, 0xb084b580, 0x6078af00, 0xff86f7ff, 0x687b4602, 0xd3014293, 0xe0302301, + 0xf7ff6878, 0x60f8ff4d, 0xff5af7ff, 0xff68f7ff, 0x691b4b16, 0xf0434a15, 0x611303b8, 0x22024b13, + 0x4b12615a, 0x68fb695a, 0xf40300db, 0x490f63ff, 0x614b4313, 0x695b4b0d, 0xf4434a0c, 0x61533380, + 0xff3ef7ff, 0x691b4b09, 0x03b8f003, 0xd0072b00, 0x691b4b06, 0xf0434a05, 0x611303b8, 0xe0002301, + 0x46182300, 0x46bd3710, 0xbf00bd80, 0x58004000, 0xb082b580, 0xf04faf00, 0x607b6300, 0x6878e00b, + 0xffb2f7ff, 0x2b004603, 0x2301d001, 0x687be00a, 0x5380f503, 0xf7ff607b, 0x4602ff33, 0x4293687b, + 0x2300d3ed, 0x37084618, 0xbd8046bd, 0xb086b5b0, 0x60f8af00, 0x607a60b9, 0x330368bb, 0x0303f023, + 0x68fb60bb, 0x0307f023, 0xf7ff60fb, 0x4602ff19, 0x429368fb, 0x2300d301, 0xf7ffe07c, 0xf7fffef1, + 0x4b3efeff, 0x4a3d691b, 0x03b8f043, 0x4b3b6113, 0x7280f04f, 0xf04f615a, 0xf04f0200, 0xe9c70300, + 0xe0632304, 0x695b4b35, 0xf0434a34, 0x61530301, 0xfef6f7ff, 0x68fb4602, 0xd30d4293, 0x695b4b2f, + 0xf0234a2e, 0x61530301, 0x691b4b2c, 0xf0434a2b, 0x611303b8, 0xe04d2301, 0x681b687b, 0xf04f461a, + 0xe9c70300, 0x687b2304, 0x681b3304, 0xf04f4618, 0xf04f0100, 0xf04f0200, 0x00030300, 0xe9d72200, + 0x18840104, 0x0503eb41, 0x4504e9c7, 0x2304e9d7, 0xf7ff68f8, 0x68fbfedb, 0x60fb3308, 0x3308687b, + 0x68bb607b, 0x60bb3b08, 0xfe9af7ff, 0x691b4b13, 0x0301f003, 0xd10d2b00, 0x695b4b10, 0xf0234a0f, + 0x61530301, 0x691b4b0d, 0xf0434a0c, 0x611303b8, 0xe00f2301, 0x691b4b09, 0xf0434a08, 0x61130301, + 0x695b4b06, 0xf0234a05, 0x61530301, 0x2b0068bb, 0x2300d198, 0x37184618, 0xbdb046bd, 0x58004000 +}; + +// 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, 0x00001000, +}; + +static const program_target_t flash = { + 0x200000cd, // Init + 0x20000111, // UnInit + 0x200001d5, // EraseChip + 0x2000014d, // EraseSector + 0x20000211, // ProgramPage + 0x0, // Verify + + // BKPT : start of blob + 1 + // RSB : blob start + header + rw data offset + // RSP : stack pointer + { + 0x20000001, + 0x20000344, + 0x20000600 + }, + + 0x20000000 + 0x00000A00, // mem buffer location + 0x20000000, // location to write prog_blob in target RAM + sizeof(stm32wb55_flash_prog_blob), // prog_blob size + stm32wb55_flash_prog_blob, // address of prog_blob + 0x00000400 // ram_to_flash_bytes_to_be_written +}; \ No newline at end of file diff --git a/source/family/st/stm32wb55rg/target.c b/source/family/st/stm32wb55rg/target.c new file mode 100644 index 0000000000..36379eaef6 --- /dev/null +++ b/source/family/st/stm32wb55rg/target.c @@ -0,0 +1,38 @@ +/** + * @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 = 0x20030000, + .erase_reset = 1, +}; From 680412f0fe96c2f644341c9d692ffaacb6dbd948 Mon Sep 17 00:00:00 2001 From: Mathias Brossard Date: Sat, 23 Sep 2023 14:48:55 -0500 Subject: [PATCH 5/7] stm32wb55rg_if: Updates for NUCLEO-WB55 board Add CMSIS-DAP 2.1 new fields and update flash algo --- source/board/stm32wb55rg.c | 6 +- source/family/st/stm32wb55rg/flash_blob.c | 99 ++++++++++++----------- source/family/st/stm32wb55rg/target.c | 4 +- 3 files changed, 61 insertions(+), 48 deletions(-) diff --git a/source/board/stm32wb55rg.c b/source/board/stm32wb55rg.c index e3919f0559..400febc9d8 100644 --- a/source/board/stm32wb55rg.c +++ b/source/board/stm32wb55rg.c @@ -1,9 +1,9 @@ /** * @file stm32wb55rg.c - * @brief board ID for the STM32WB55 board + * @brief board ID for the NUCLEO-WB55 board * * DAPLink Interface Firmware - * Copyright (c) 2009-2019, 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 @@ -27,4 +27,6 @@ const board_info_t g_board_info = { .board_id = "0839", .family_id = kStub_HWReset_FamilyID, .target_cfg = &target_device, + .board_vendor = "STMicroelectronics", + .board_name = "NUCLEO-WB55", }; diff --git a/source/family/st/stm32wb55rg/flash_blob.c b/source/family/st/stm32wb55rg/flash_blob.c index 0d4bdbbe87..9d502f6afc 100644 --- a/source/family/st/stm32wb55rg/flash_blob.c +++ b/source/family/st/stm32wb55rg/flash_blob.c @@ -1,5 +1,8 @@ -/* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2019ARM Limited +/* Flash algorithm for STM32WB5x_M4_1024 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. @@ -14,34 +17,33 @@ * limitations under the License. */ -static const uint32_t stm32wb55_flash_prog_blob[] = { - 0xE00ABE00, - 0xb085b480, 0x6078af00, 0xf103687b, 0x60fb4378, 0x0b1b68fb, 0x37144618, 0xbc8046bd, 0x00004770, - 0xaf00b480, 0x4b05bf00, 0xf403691b, 0x2b003380, 0xbf00d1f9, 0x46bdbf00, 0x4770bc80, 0x58004000, - 0xaf00b480, 0x4b05bf00, 0xf403691b, 0x2b002300, 0xbf00d1f9, 0x46bdbf00, 0x4770bc80, 0x58004000, - 0xb083b480, 0x4b08af00, 0x3080f8d3, 0x607bb2db, 0x031b687b, 0x687b607b, 0x6300f103, 0x370c4618, - 0xbc8046bd, 0xbf004770, 0x58004000, 0xb085b480, 0x60f8af00, 0x2300e9c7, 0x683a68fb, 0xf3bf601a, - 0xbf008f6f, 0x0100e9d7, 0x0200f04f, 0x0300f04f, 0x2300000a, 0x310468f9, 0x600b4613, 0x3714bf00, - 0xbc8046bd, 0x00004770, 0xb085b480, 0x60f8af00, 0x607a60b9, 0x695b4b0a, 0xda052b00, 0x4a094b08, - 0x4b07609a, 0x609a4a08, 0x691b4b05, 0xf0434a04, 0x611303b8, 0x46182300, 0x46bd3714, 0x4770bc80, - 0x58004000, 0x45670123, 0xcdef89ab, 0xb085b480, 0x6078af00, 0x681b4b0b, 0x4a0a60fb, 0xf42368fb, - 0x601353f8, 0x68fb4a07, 0x4b066013, 0x4a05695b, 0x4300f043, 0x23006153, 0x37144618, 0xbc8046bd, - 0xbf004770, 0x58004000, 0xb084b580, 0x6078af00, 0xff86f7ff, 0x687b4602, 0xd3014293, 0xe0302301, - 0xf7ff6878, 0x60f8ff4d, 0xff5af7ff, 0xff68f7ff, 0x691b4b16, 0xf0434a15, 0x611303b8, 0x22024b13, - 0x4b12615a, 0x68fb695a, 0xf40300db, 0x490f63ff, 0x614b4313, 0x695b4b0d, 0xf4434a0c, 0x61533380, - 0xff3ef7ff, 0x691b4b09, 0x03b8f003, 0xd0072b00, 0x691b4b06, 0xf0434a05, 0x611303b8, 0xe0002301, - 0x46182300, 0x46bd3710, 0xbf00bd80, 0x58004000, 0xb082b580, 0xf04faf00, 0x607b6300, 0x6878e00b, - 0xffb2f7ff, 0x2b004603, 0x2301d001, 0x687be00a, 0x5380f503, 0xf7ff607b, 0x4602ff33, 0x4293687b, - 0x2300d3ed, 0x37084618, 0xbd8046bd, 0xb086b5b0, 0x60f8af00, 0x607a60b9, 0x330368bb, 0x0303f023, - 0x68fb60bb, 0x0307f023, 0xf7ff60fb, 0x4602ff19, 0x429368fb, 0x2300d301, 0xf7ffe07c, 0xf7fffef1, - 0x4b3efeff, 0x4a3d691b, 0x03b8f043, 0x4b3b6113, 0x7280f04f, 0xf04f615a, 0xf04f0200, 0xe9c70300, - 0xe0632304, 0x695b4b35, 0xf0434a34, 0x61530301, 0xfef6f7ff, 0x68fb4602, 0xd30d4293, 0x695b4b2f, - 0xf0234a2e, 0x61530301, 0x691b4b2c, 0xf0434a2b, 0x611303b8, 0xe04d2301, 0x681b687b, 0xf04f461a, - 0xe9c70300, 0x687b2304, 0x681b3304, 0xf04f4618, 0xf04f0100, 0xf04f0200, 0x00030300, 0xe9d72200, - 0x18840104, 0x0503eb41, 0x4504e9c7, 0x2304e9d7, 0xf7ff68f8, 0x68fbfedb, 0x60fb3308, 0x3308687b, - 0x68bb607b, 0x60bb3b08, 0xfe9af7ff, 0x691b4b13, 0x0301f003, 0xd10d2b00, 0x695b4b10, 0xf0234a0f, - 0x61530301, 0x691b4b0d, 0xf0434a0c, 0x611303b8, 0xe00f2301, 0x691b4b09, 0xf0434a08, 0x61130301, - 0x695b4b06, 0xf0234a05, 0x61530301, 0x2b0068bb, 0x2300d198, 0x37184618, 0xbdb046bd, 0x58004000 +// Generated from 'STM32WB5x_M4_1024.FLM' (STM32WB5x_M4_1024 Flash) +// Originating from 'Keil.STM32WBxx_DFP.1.3.0.pack' +// digest = 38c919a97147eb8c66aac4308cd7a3d9952f3d832795f0a36d7e960ad8630f85, file size = 16084 +// algo version = 0x101, algo size = 648 (0x288) +static const uint32_t STM32WB5x_M4_1024_flash_prog_blob[] = { + 0xe7fdbe00, + 0x4770ba40, 0x4770bac0, 0x0030ea4f, 0x00004770, 0x204cf3c0, 0xf3bf4770, 0x47708f4f, 0x4892b672, + 0x29006941, 0x4991da03, 0x49916081, 0x6a006081, 0xd41003c0, 0xf64a488f, 0x600121aa, 0x60011049, + 0x60412106, 0x71fff640, 0x10c86081, 0x6008498a, 0x1f09207f, 0xb6626008, 0x47702000, 0x69414882, + 0x4100f041, 0x20006141, 0xb5104770, 0xf3c0b672, 0x487d224c, 0x03c96901, 0x6901d4fc, 0xd4fc0349, + 0x03096901, 0x6901d4fc, 0x34faf244, 0x61014321, 0xf6416941, 0x439973f8, 0x69416141, 0x0202f042, + 0x61414311, 0xf4416941, 0x61413180, 0x21aaf64a, 0xe0004a70, 0x69036011, 0xd4fb03db, 0xf0216941, + 0x61410102, 0x42216901, 0x6901d004, 0x61014321, 0xbd102001, 0x6100f04f, 0x1c496809, 0x6801d103, + 0x3180f441, 0xb6626001, 0xbd102000, 0xb672b530, 0x6a01485d, 0x05cb4a5f, 0x21aaf64a, 0xf890d510, + 0x495e0080, 0x6400f04f, 0x3500eb01, 0x4620e004, 0xffabf7ff, 0x5480f504, 0xd9f842ac, 0x6011e021, + 0x03db6903, 0x6903d4fb, 0x34faf244, 0x61034323, 0xf0436943, 0x61430304, 0xf4436943, 0x61433380, + 0x6011e000, 0x03db6903, 0x6941d4fb, 0x0104f021, 0x69016141, 0xd0044221, 0x43216901, 0x20016101, + 0xb662bd30, 0xbd302000, 0x4df0e92d, 0xb672b088, 0x2aaaf64a, 0xb0fcf8df, 0xe0014e3b, 0xa000f8cb, + 0x03db6933, 0xf244d4fa, 0x613737fa, 0x0e01f04f, 0xe014f8c6, 0xe05446ec, 0xe014f8c6, 0xd3132908, + 0x60036813, 0x60436853, 0x8f4ff3bf, 0x465b4654, 0x601ce000, 0x03ed6935, 0x6933d4fb, 0xd13b423b, + 0x39083008, 0xe03c3208, 0xe0042300, 0x4b01f812, 0x4023f84c, 0x428b1c5b, 0x2300d3f8, 0xf1c124ff, + 0xe0040508, 0x0801eb03, 0xf84c1c5b, 0x429d4028, 0xe9ddd8f8, 0xeb011300, 0x9b022103, 0x041b9c03, + 0x6304eb03, 0x91004419, 0x1304e9dd, 0x2103eb01, 0x9c079b06, 0xeb03041b, 0x44196304, 0x99009101, + 0x99016001, 0xf3bf6041, 0x21008f4f, 0x03db6933, 0x6933d4fc, 0xd004423b, 0x20016137, 0xe8bdb008, + 0x29008df0, 0x6970d1a8, 0x0001f020, 0xf04f6170, 0x68006000, 0xd0031c40, 0xf4206830, 0x60303080, + 0x2000b662, 0x0000e7ea, 0x58004000, 0x45670123, 0xcdef89ab, 0x40003000, 0x40002c04, 0x07fff000, + 0x00000000 }; // Start address of flash @@ -57,29 +59,36 @@ static const uint32_t flash_size = 0x00100000; * at address flash_start + flash_size. */ static const sector_info_t sectors_info[] = { - 0x08000000, 0x00001000, + {0x08000000, 0x00001000}, }; static const program_target_t flash = { - 0x200000cd, // Init - 0x20000111, // UnInit - 0x200001d5, // EraseChip - 0x2000014d, // EraseSector - 0x20000211, // ProgramPage - 0x0, // Verify + 0x20000021, // Init + 0x20000061, // UnInit + 0x200000f1, // EraseChip + 0x2000006f, // EraseSector + 0x2000016d, // ProgramPage + 0x00000000, // Verify // BKPT : start of blob + 1 // RSB : blob start + header + rw data offset // RSP : stack pointer { 0x20000001, - 0x20000344, - 0x20000600 + 0x20000284, + 0x20000c00 }, - 0x20000000 + 0x00000A00, // mem buffer location - 0x20000000, // location to write prog_blob in target RAM - sizeof(stm32wb55_flash_prog_blob), // prog_blob size - stm32wb55_flash_prog_blob, // address of prog_blob - 0x00000400 // ram_to_flash_bytes_to_be_written -}; \ No newline at end of file + // mem buffer location + 0x20000c00, + // location to write prog_blob in target RAM + 0x20000000, + // prog_blob size + sizeof(STM32WB5x_M4_1024_flash_prog_blob), + // address of prog_blob + STM32WB5x_M4_1024_flash_prog_blob, + // ram_to_flash_bytes_to_be_written + 0x00000400, + // algo_flags (combination of kAlgoVerifyReturnsAddress, kAlgoSingleInitType and kAlgoSkipChipErase) + 0x00000000 +}; diff --git a/source/family/st/stm32wb55rg/target.c b/source/family/st/stm32wb55rg/target.c index 36379eaef6..bdd041653d 100644 --- a/source/family/st/stm32wb55rg/target.c +++ b/source/family/st/stm32wb55rg/target.c @@ -31,8 +31,10 @@ target_cfg_t target_device = { .flash_regions[0].start = 0x08000000, .flash_regions[0].end = 0x08100000, .flash_regions[0].flags = kRegionIsDefault, - .flash_regions[0].flash_algo = (program_target_t *) &flash, + .flash_regions[0].flash_algo = (program_target_t *) &flash, .ram_regions[0].start = 0x20000000, .ram_regions[0].end = 0x20030000, .erase_reset = 1, + .target_vendor = "STMicroelectronics", + .target_part_number = "STM32WB55RGVx", }; From ad022ca5f9afb4c5bc511bf0004fed202d9235ad Mon Sep 17 00:00:00 2001 From: Mathias Brossard Date: Sat, 23 Sep 2023 15:00:47 -0500 Subject: [PATCH 6/7] docs: Update porting documentation --- docs/PORT_BOARD.md | 9 ++++++--- docs/PORT_TARGET_FAMILY.md | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/PORT_BOARD.md b/docs/PORT_BOARD.md index ebcfbf750a..f4dbbd07b8 100644 --- a/docs/PORT_BOARD.md +++ b/docs/PORT_BOARD.md @@ -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 @@ -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`. diff --git a/docs/PORT_TARGET_FAMILY.md b/docs/PORT_TARGET_FAMILY.md index 72cb8d82fb..11680be774 100644 --- a/docs/PORT_TARGET_FAMILY.md +++ b/docs/PORT_TARGET_FAMILY.md @@ -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 @@ -70,7 +70,7 @@ 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///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///flash_blob.c`: ```c /** @@ -78,7 +78,7 @@ A flash algorithm blob is needed to program the target MCUs internal (or externa * @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 @@ -144,7 +144,7 @@ The last required file is the target MCU description file `source/family//< * @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 @@ -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", }; ``` From 5b9d7de4b7d435755e125b0e85109ca1c8ca1327 Mon Sep 17 00:00:00 2001 From: Mathias Brossard Date: Mon, 25 Sep 2023 21:04:50 -0500 Subject: [PATCH 7/7] rtos: Use same main task stack size as rtos2 --- source/rtos/cmsis_os2_port.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/rtos/cmsis_os2_port.c b/source/rtos/cmsis_os2_port.c index bcb5c0bd40..00f854a508 100644 --- a/source/rtos/cmsis_os2_port.c +++ b/source/rtos/cmsis_os2_port.c @@ -23,11 +23,11 @@ #include "RTL.h" #include "cortex_m.h" -#define MAIN_TASK_PRIORITY (10) -#define MAIN_TASK_STACK (800) +#include "interface/tasks.h" + static uint64_t stk_main_task [MAIN_TASK_STACK / sizeof(uint64_t)]; -#define TIMER_TASK_30_PRIORITY (11) +#define TIMER_TASK_30_PRIORITY (MAIN_TASK_PRIORITY + 1) #define TIMER_TASK_STACK (136) static uint64_t stk_timer_task[TIMER_TASK_STACK / sizeof(uint64_t)];