Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YUNTU new device YTM32B1HA0 support. #1643

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pyocd/target/builtin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
from . import target_ytm32b1le0
from . import target_ytm32b1me0
from . import target_ytm32b1md1
from . import target_ytm32b1ha0
from . import target_ytm32b1mc0
from . import target_STM32H723xx
from . import target_STM32H743xx
from . import target_STM32H7B0xx
Expand Down Expand Up @@ -302,10 +304,14 @@
'rp2040' : target_RP2040.RP2040Core0,
'rp2040_core0' : target_RP2040.RP2040Core0,
'rp2040_core1' : target_RP2040.RP2040Core1,
'ytm32b1ld0': target_ytm32b1ld0.YTM32B1LD0,
'ytm32b1le0': target_ytm32b1le0.YTM32B1LE0,
'ytm32b1me0': target_ytm32b1me0.YTM32B1ME0,
'ytm32b1md1': target_ytm32b1md1.YTM32B1MD1,
'ytm32b1ld04': target_ytm32b1ld0.YTM32B1LD0,
'ytm32b1le04': target_ytm32b1le0.YTM32B1LE0,
'ytm32b1le05': target_ytm32b1le0.YTM32B1LE0,
'ytm32b1me05': target_ytm32b1me0.YTM32B1ME0,
'ytm32b1md14': target_ytm32b1md1.YTM32B1MD1,
'ytm32b1md24': target_ytm32b1md1.YTM32B1MD1,
'ytm32b1ha01': target_ytm32b1ha0.YTM32B1HA0,
'ytm32b1mc03': target_ytm32b1mc0.YTM32B1MC0,
'air001': target_Air001.Air001,
'air32f103xb': target_Air32F103xx.Air32F103xB,
'air32f103xc': target_Air32F103xx.Air32F103xC,
Expand Down
153 changes: 153 additions & 0 deletions pyocd/target/builtin/target_ytm32b1ha0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# pyOCD debugger
# Copyright (c) 2022 Yuntu Microelectronics
# 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.

from ...coresight.coresight_target import CoreSightTarget
from ...core.memory_map import (FlashRegion, RamRegion, MemoryMap)

MAIN_FLASH_ALGO = {
'load_address' : 0x20060000,

# Flash algorithm as a hex string
'instructions': [
0xe7fdbe00,
0x48804601, 0x4a7f6840, 0x29006050, 0x487ed005, 0x60104a7e, 0x4a7bb2c8, 0xbf006090, 0x68404879,
0x40102280, 0xd0f92800, 0x68404876, 0x40104a78, 0xd0012800, 0x47702001, 0xe7fc2000, 0x4604b570,
0x4616460d, 0x69404873, 0x04092101, 0x49714388, 0xf3bf6148, 0x20008f4f, 0x6008496f, 0x8f4ff3bf,
0x3840486d, 0x21016900, 0x496b4308, 0x61083940, 0x496b486a, 0x486b6008, 0x46086008, 0x08406840,
0x60480040, 0x49642003, 0x60083940, 0x4862bf00, 0x68803840, 0x0f800780, 0xd1f82803, 0x495e2001,
0x60483940, 0x485cbf00, 0x68c03840, 0xd1fa2801, 0x4859bf00, 0x68803840, 0x40082104, 0xd1f82804,
0x49552000, 0x60083940, 0x494e4857, 0x20006008, 0xff96f7ff, 0x4601bd70, 0x47702000, 0x4604b510,
0x68404848, 0x60484947, 0x68004608, 0x03092101, 0x49444308, 0xf3bf6008, 0xf3bf8f6f, 0x484b8f4f,
0xf3bf6020, 0xf3bf8f6f, 0x483e8f4f, 0x21016800, 0x43880309, 0x6008493b, 0xf7ff2011, 0xbd10ff71,
0x2400b510, 0x06402001, 0xffd8f7ff, 0x20214604, 0xf7ff0500, 0x4304ffd3, 0x06402003, 0xffcef7ff,
0x20004304, 0xb510bd10, 0x482e4604, 0x492d6840, 0x46086048, 0x21016800, 0x43080309, 0x60084929,
0x8f6ff3bf, 0x8f4ff3bf, 0x60204830, 0x8f6ff3bf, 0x8f4ff3bf, 0x68004823, 0x03092101, 0x49214388,
0x20106008, 0xff3cf7ff, 0xb5f7bd10, 0x4604b082, 0x9e04460d, 0x20204627, 0x95009001, 0x4819bf00,
0x49186840, 0x46086048, 0x21016800, 0x43080309, 0x60084914, 0x8f6ff3bf, 0x8f4ff3bf, 0xe0022000,
0xc702ce02, 0x28081c40, 0xf3bfdbfa, 0xf3bf8f6f, 0x480c8f4f, 0x21016800, 0x43880309, 0x60084909,
0xf7ff2002, 0x2800ff0d, 0x2001d002, 0xbdf0b005, 0x98009901, 0x90001a40, 0x28009800, 0x2000dccf,
0x0000e7f4, 0x40040000, 0xfd9573f5, 0x40040200, 0x1f00001e, 0xe000e000, 0x401f0040, 0x0000b631,
0x401a8000, 0x0000c278, 0x00188200, 0x12345678, 0x00000000
],

# Relative function addresses
'pc_init': 0x20060041,
'pc_unInit': 0x200600db,
'pc_program_page': 0x2006018f,
'pc_erase_sector': 0x2006014b,
'pc_eraseAll': 0x20060125,

'static_base' : 0x20060000 + 0x00000004 + 0x00000230,
'begin_stack' : 0x20062a40,
'end_stack' : 0x20061a40,
'begin_data' : 0x20060000 + 0x1000,
'page_size' : 0x400,
'analyzer_supported' : False,
'analyzer_address' : 0x00000000,
# Enable double buffering
'page_buffers' : [
],
'min_program_length' : 0x400,

# Relative region addresses and sizes
'ro_start': 0x4,
'ro_size': 0x230,
'rw_start': 0x234,
'rw_size': 0x4,
'zi_start': 0x238,
'zi_size': 0x0,

# Flash information
'flash_start': 0x2000000,
'flash_size': 0x2200000,
'sector_sizes': (
(0x0, 0x800),
)
}
DATA_FLASH_ALGO = {
'load_address' : 0x20060000,

# Flash algorithm as a hex string
'instructions': [
0xe7fdbe00,
0x2201b510, 0x49190410, 0x4383680b, 0xf3bf600b, 0x48178f4f, 0x64012100, 0x8f4ff3bf, 0x43136903,
0x4b146103, 0x601c4c14, 0x601c4c14, 0x4394685c, 0x2303605c, 0x68846003, 0x2c03401c, 0x6042d1fb,
0x2a0168c2, 0x6882d1fc, 0xd5fc0752, 0x480c6001, 0x4a0c1f01, 0x6801600a, 0x68016001, 0xd5fc0609,
0x48096801, 0x1e414008, 0xbd104188, 0xe000e014, 0x401f0000, 0x401a8000, 0x0000b631, 0x0000c278,
0x40040004, 0x00188200, 0x1f00001e, 0x47702000, 0x4914b510, 0x600a680a, 0x03122201, 0x681c1f0b,
0x601c4314, 0x8f6ff3bf, 0x8f4ff3bf, 0x60044c0e, 0x8f6ff3bf, 0x8f4ff3bf, 0x06406808, 0x6818d5fc,
0x60184390, 0x60086808, 0x4a094808, 0x20116002, 0x68086048, 0xd5fc0600, 0x48066809, 0x1e414008,
0xbd104188, 0x40040004, 0x12345678, 0x40040200, 0xfd9573f5, 0x1f00001e, 0x4815b510, 0x60016801,
0x03092101, 0x68131f02, 0x6013430b, 0x8f6ff3bf, 0x8f4ff3bf, 0x065b2303, 0x601c4c0e, 0x8f6ff3bf,
0x8f4ff3bf, 0x065b6803, 0x6813d5fc, 0x6013438b, 0x60016801, 0x4a094908, 0x2111600a, 0x68016041,
0xd5fc0609, 0x48066801, 0x1e414008, 0xbd104188, 0x40040004, 0x12345678, 0x40040200, 0xfd9573f5,
0x1f00001e, 0x4914b510, 0x600a680a, 0x03122201, 0x681c1f0b, 0x601c4314, 0x8f6ff3bf, 0x8f4ff3bf,
0x60044c0e, 0x8f6ff3bf, 0x8f4ff3bf, 0x06406808, 0x6818d5fc, 0x60184390, 0x60086808, 0x4a094808,
0x20106002, 0x68086048, 0xd5fc0600, 0x48066809, 0x1e414008, 0xbd104188, 0x40040004, 0x12345678,
0x40040200, 0xfd9573f5, 0x1f00001e, 0xb081b5f0, 0x68234c1a, 0x23016023, 0x031d9300, 0x68371f26,
0x6037432f, 0x8f6ff3bf, 0x8f4ff3bf, 0x59d32700, 0x1d3f51c3, 0xd0fa2f04, 0x19c019d2, 0x8f6ff3bf,
0x8f4ff3bf, 0x065b6823, 0x6833d5fc, 0x603343ab, 0x60236823, 0x4d0b4b0a, 0x9e00601d, 0x68236066,
0xd5fc061b, 0x4d086823, 0xd103422b, 0x29003908, 0x2600dccf, 0xb0014630, 0x46c0bdf0, 0x40040004,
0x40040200, 0xfd9573f5, 0x1f00001e, 0x00000000
],

# Relative function addresses
'pc_init': 0x20060005,
'pc_unInit': 0x20060091,
'pc_program_page': 0x200601d1,
'pc_erase_sector': 0x20060169,
'pc_eraseAll': 0x200600fd,

'static_base' : 0x20060000 + 0x00000004 + 0x0000024c,
'begin_stack' : 0x20002460,
'end_stack' : 0x20061460,
'begin_data' : 0x20060000 + 0x1000,
'page_size' : 0x100,
'analyzer_supported' : False,
'analyzer_address' : 0x00000000,
# Enable double buffering
'page_buffers' : [
],
'min_program_length' : 0x100,

# Relative region addresses and sizes
'ro_start': 0x4,
'ro_size': 0x24c,
'rw_start': 0x250,
'rw_size': 0x4,
'zi_start': 0x254,
'zi_size': 0x0,

# Flash information
'flash_start': 0x6000000,
'flash_size': 0x40000,
'sector_sizes': (
(0x0, 0x400),
)
}

class YTM32B1HA0(CoreSightTarget):

VENDOR = "Yuntu Microelectronics"

MEMORY_MAP = MemoryMap(
FlashRegion( start=0x02000000, length=0x200000, blocksize=0x800, is_boot_memory=True, algo=MAIN_FLASH_ALGO),
FlashRegion( start=0x06000000, length=0x040000, blocksize=0x400, is_boot_memory=False, algo=DATA_FLASH_ALGO),
RamRegion( start=0x20060000, length=0x10000)
)

def __init__(self, session):
super().__init__(session, self.MEMORY_MAP)
4 changes: 0 additions & 4 deletions pyocd/target/builtin/target_ytm32b1ld0.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
'analyzer_address' : 0x00000000,
# Enable double buffering
'page_buffers' : [
0x20000140,
0x20000240
],
'min_program_length' : 0x100,

Expand Down Expand Up @@ -106,8 +104,6 @@
'analyzer_address' : 0x00000000,
# Enable double buffering
'page_buffers' : [
0x20000150,
0x20000250
],
'min_program_length' : 0x100,

Expand Down
4 changes: 0 additions & 4 deletions pyocd/target/builtin/target_ytm32b1le0.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
'analyzer_address' : 0x00000000,
# Enable double buffering
'page_buffers' : [
0x20000140,
0x20000148
],
'min_program_length' : 0x8,

Expand Down Expand Up @@ -105,8 +103,6 @@
'analyzer_address' : 0x00000000,
# Enable double buffering
'page_buffers' : [
0x20000140,
0x20000148
],
'min_program_length' : 0x8,

Expand Down
151 changes: 151 additions & 0 deletions pyocd/target/builtin/target_ytm32b1mc0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# pyOCD debugger
# Copyright (c) 2022 Yuntu Microelectronics
# 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.

from ...coresight.coresight_target import CoreSightTarget
from ...core.memory_map import (FlashRegion, RamRegion, MemoryMap)

MAIN_FLASH_ALGO = {
'load_address' : 0x20000000,

# Flash algorithm as a hex string
'instructions': [
0xe7fdbe00,
0x48714601, 0x4a706840, 0x29006050, 0x486fd005, 0x60104a6f, 0x4a6cb2c8, 0xbf006090, 0x6840486a,
0x40102280, 0xd0f92800, 0x68404867, 0x40104a69, 0xd0012800, 0x47702001, 0xe7fc2000, 0x4604b570,
0x4616460d, 0x49642000, 0xf3bf6008, 0x48628f4f, 0x69003840, 0x43082101, 0x3940495f, 0x485f6108,
0x6008495f, 0x6008485f, 0x68404608, 0x00400840, 0x20036048, 0x39404958, 0xbf006008, 0x38404856,
0x07806880, 0x28030f80, 0x2001d1f8, 0x39404952, 0xbf006048, 0x38404850, 0x280168c0, 0xbf00d1fa,
0x3840484d, 0x21046880, 0x28044008, 0x2000d1f8, 0x39404949, 0x484c6008, 0x60084943, 0xf7ff2000,
0xbd70ff9f, 0x20004601, 0xb5104770, 0x483e2400, 0x21016800, 0x43080309, 0x6008493b, 0x8f6ff3bf,
0x8f4ff3bf, 0x21004841, 0xf3bf6008, 0xf3bf8f6f, 0x20118f4f, 0xff84f7ff, 0xf3bf1904, 0xf3bf8f6f,
0x483a8f4f, 0x04492101, 0xf3bf6008, 0xf3bf8f6f, 0x20118f4f, 0xff74f7ff, 0x46201904, 0xb510bd10,
0x48294604, 0x21016800, 0x43080309, 0x60084926, 0x8f6ff3bf, 0x8f4ff3bf, 0x6020482c, 0x8f6ff3bf,
0x8f4ff3bf, 0x68004820, 0x03092101, 0x491e4388, 0x20106008, 0xff54f7ff, 0xb5f7bd10, 0x4604b082,
0x9e04460d, 0x20084627, 0x95009001, 0x4816bf00, 0x21016800, 0x43080309, 0x60084913, 0x8f6ff3bf,
0x8f4ff3bf, 0xe0022000, 0xc702ce02, 0x28021c40, 0xf3bfdbfa, 0xf3bf8f6f, 0x20018f4f, 0xff30f7ff,
0xd0022800, 0xb0052001, 0x9901bdf0, 0x1a409800, 0x480f9000, 0x6008490a, 0x6008480e, 0x28009800,
0x2000dcd5, 0x0000e7ef, 0x40010000, 0xfd9573f5, 0x40010200, 0x1f00001e, 0x4007c040, 0x0000b631,
0x4006a000, 0x0000c278, 0x00288200, 0x12345678, 0x0000a518, 0x0000d826, 0x00000000
],

# Relative function addresses
'pc_init': 0x20000041,
'pc_unInit': 0x200000c9,
'pc_program_page': 0x2000015f,
'pc_erase_sector': 0x20000123,
'pc_eraseAll': 0x200000cf,

'static_base' : 0x20000000 + 0x00000004 + 0x000001f8,
'begin_stack' : 0x20002400,
'end_stack' : 0x20001400,
'begin_data' : 0x20000000 + 0x1000,
'page_size' : 0x100,
'analyzer_supported' : False,
'analyzer_address' : 0x00000000,
# Enable double buffering
'page_buffers' : [
],
'min_program_length' : 0x100,

# Relative region addresses and sizes
'ro_start': 0x4,
'ro_size': 0x1f8,
'rw_start': 0x1fc,
'rw_size': 0x4,
'zi_start': 0x200,
'zi_size': 0x0,

# Flash information
'flash_start': 0x0,
'flash_size': 0x40000,
'sector_sizes': (
(0x0, 0x200),
)
}
DATA_FLASH_ALGO = {
'load_address' : 0x20000000,

# Flash algorithm as a hex string
'instructions': [
0xe7fdbe00,
0x48754601, 0x4a746840, 0x29006050, 0x4873d005, 0x60104a73, 0x4a70b2c8, 0xbf006090, 0x6840486e,
0x40102280, 0xd0f92800, 0x6840486b, 0x40104a6d, 0xd0012800, 0x47702001, 0xe7fc2000, 0x4604b570,
0x4616460d, 0x49682000, 0xf3bf6008, 0x48668f4f, 0x69003840, 0x43082101, 0x39404963, 0x48636108,
0x60084963, 0x60084863, 0x68404608, 0x00400840, 0x20036048, 0x3940495c, 0xbf006008, 0x3840485a,
0x07806880, 0x28030f80, 0x2001d1f8, 0x39404956, 0xbf006048, 0x38404854, 0x280168c0, 0xbf00d1fa,
0x38404851, 0x21046880, 0x28044008, 0x2000d1f8, 0x3940494d, 0x48506008, 0x60084947, 0xf7ff2000,
0xbd70ff9f, 0x20004601, 0x46024770, 0xe0064611, 0x1c406808, 0xd0012800, 0x47702001, 0x1dd01d09,
0x30fa30ff, 0xd3f34281, 0xe7f62000, 0x4604b510, 0x68004839, 0x03092101, 0x49374308, 0xf3bf6008,
0xf3bf8f6f, 0x483d8f4f, 0xf3bf6020, 0xf3bf8f6f, 0x48318f4f, 0x21016800, 0x43880309, 0x6008492e,
0xf7ff2010, 0xbd10ff6d, 0x2500b570, 0x4c342400, 0x4620e00b, 0xffc9f7ff, 0xd0032800, 0xf7ff4620,
0x1945ffd5, 0x34ff34ff, 0x482e3402, 0xd3f04284, 0xe00b4c2d, 0xf7ff4620, 0x2800ffb8, 0x4620d003,
0xffc4f7ff, 0x34ff1945, 0x340234ff, 0x42844827, 0x4628d3f0, 0xb5f7bd70, 0x4604b082, 0x9e04460d,
0x20084627, 0x95009001, 0x4813bf00, 0x21016800, 0x43080309, 0x60084910, 0x8f6ff3bf, 0x8f4ff3bf,
0xe0022000, 0xc702ce02, 0x28021c40, 0xf3bfdbfa, 0xf3bf8f6f, 0x20018f4f, 0xff22f7ff, 0xd0022800,
0xb0052001, 0x9901bdf0, 0x1a409800, 0x98009000, 0xdcda2800, 0xe7f42000, 0x40010000, 0xfd9573f5,
0x40010200, 0x1f00001e, 0x4007c040, 0x0000b631, 0x4006a000, 0x0000c278, 0x00288200, 0x12345678,
0x10001000, 0x10003800, 0x10011000, 0x10013800, 0x00000000
],

# Relative function addresses
'pc_init': 0x20000041,
'pc_unInit': 0x200000c9,
'pc_program_page': 0x2000017b,
'pc_erase_sector': 0x200000f1,
'pc_eraseAll': 0x2000012d,

'static_base' : 0x20000000 + 0x00000004 + 0x00000210,
'begin_stack' : 0x20002420,
'end_stack' : 0x20001420,
'begin_data' : 0x20000000 + 0x1000,
'page_size' : 0x100,
'analyzer_supported' : False,
'analyzer_address' : 0x00000000,
# Enable double buffering
'page_buffers' : [
],
'min_program_length' : 0x100,

# Relative region addresses and sizes
'ro_start': 0x4,
'ro_size': 0x210,
'rw_start': 0x214,
'rw_size': 0x4,
'zi_start': 0x218,
'zi_size': 0x0,

# Flash information
'flash_start': 0x10001000,
'flash_size': 0x2800,
'sector_sizes': (
(0x0, 0x200),
)
}

class YTM32B1MC0(CoreSightTarget):

VENDOR = "Yuntu Microelectronics"

MEMORY_MAP = MemoryMap(
FlashRegion( start=0x00000000, length=0x040000, blocksize=0x200, is_boot_memory=True, algo=MAIN_FLASH_ALGO),
FlashRegion( start=0x10001000, length=0x002800, blocksize=0x200, is_boot_memory=False, algo=DATA_FLASH_ALGO),
FlashRegion( start=0x10011000, length=0x002800, blocksize=0x200, is_boot_memory=False, algo=DATA_FLASH_ALGO),
RamRegion( start=0x20000000, length=0x10000)
)

def __init__(self, session):
super().__init__(session, self.MEMORY_MAP)

2 changes: 0 additions & 2 deletions pyocd/target/builtin/target_ytm32b1md1.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
'analyzer_address' : 0x00000000,
# Enable double buffering
'page_buffers' : [
0x20000140,
0x20000148
],
'min_program_length' : 0x8,

Expand Down
Loading
Loading