Skip to content

Commit

Permalink
HDSC MCU updated targets and added new PNs.
Browse files Browse the repository at this point in the history
 - Updated targets HC32F448/45x/460/4A0(2).
 - New targets HC32F115/155/334/467/472.
 - New PNs: hc32a448, hc32f4a2, hc32f115, hc32f155, hc32f334, hc32f467, hc32f472.
  • Loading branch information
wuze committed Dec 6, 2024
1 parent 5166025 commit 999eb4a
Show file tree
Hide file tree
Showing 18 changed files with 334,488 additions and 138,923 deletions.
15,255 changes: 15,255 additions & 0 deletions pyocd/debug/svd/data/HC32F115.svd

Large diffs are not rendered by default.

18,047 changes: 18,047 additions & 0 deletions pyocd/debug/svd/data/HC32F155.svd

Large diffs are not rendered by default.

58,136 changes: 58,136 additions & 0 deletions pyocd/debug/svd/data/HC32F334.svd

Large diffs are not rendered by default.

8,058 changes: 2,290 additions & 5,768 deletions pyocd/debug/svd/data/HC32F448.svd

Large diffs are not rendered by default.

42,736 changes: 20,285 additions & 22,451 deletions pyocd/debug/svd/data/HC32F460.svd

Large diffs are not rendered by default.

96,316 changes: 96,316 additions & 0 deletions pyocd/debug/svd/data/HC32F467.svd

Large diffs are not rendered by default.

73,876 changes: 73,876 additions & 0 deletions pyocd/debug/svd/data/HC32F472.svd

Large diffs are not rendered by default.

159,327 changes: 48,916 additions & 110,411 deletions pyocd/debug/svd/data/HC32F4A0.svd

Large diffs are not rendered by default.

34 changes: 33 additions & 1 deletion pyocd/target/builtin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,16 @@
from . import target_M460
from . import target_M480
from . import target_M2354
from . import target_HC32F334
from . import target_HC32F448
from . import target_HC32F45x
from . import target_HC32F460
from . import target_HC32F467
from . import target_HC32F472
from . import target_HC32F4A0
from . import target_HC32M423
from . import target_HC32F115
from . import target_HC32F155
from . import target_HC32F160
from . import target_HC32x120
from . import target_HC32L110
Expand Down Expand Up @@ -274,25 +279,52 @@
'm467hjhae' : target_M460.M467HJHAE,
'm487jidae' : target_M480.M487JIDAE,
'm2354kjfae' : target_M2354.M2354KJFAE,
'hc32f334x8' : target_HC32F334.HC32F334x8,
'hc32f334xa' : target_HC32F334.HC32F334xA,
'hc32f334' : target_HC32F334.HC32F334xA,
'hc32f448xa' : target_HC32F448.HC32F448xA,
'hc32f448xc' : target_HC32F448.HC32F448xC,
'hc32f448' : target_HC32F448.HC32F448xC,
'hc32a448xa' : target_HC32F448.HC32F448xA,
'hc32a448xc' : target_HC32F448.HC32F448xC,
'hc32a448' : target_HC32F448.HC32F448xC,
'hc32f451xc' : target_HC32F45x.HC32F451xC,
'hc32f451xe' : target_HC32F45x.HC32F451xE,
'hc32f451' : target_HC32F45x.HC32F451xE,
'hc32f452xc' : target_HC32F45x.HC32F452xC,
'hc32f452xe' : target_HC32F45x.HC32F452xE,
'hc32f452' : target_HC32F45x.HC32F452xE,
'hc32f460xc' : target_HC32F460.HC32F460xC,
'hc32f460xe' : target_HC32F460.HC32F460xE,
'hc32f460' : target_HC32F460.HC32F460xE,
'hc32a460xe' : target_HC32F460.HC32F460xE,
'hc32a460' : target_HC32F460.HC32F460xE,
'hc32f467xg' : target_HC32F467.HC32F467xG,
'hc32f467' : target_HC32F467.HC32F467xG,
'hc32f472xc' : target_HC32F472.HC32F472xC,
'hc32f472xe' : target_HC32F472.HC32F472xE,
'hc32f472' : target_HC32F472.HC32F472xE,
'hc32f4a0xg' : target_HC32F4A0.HC32F4A0xG,
'hc32f4a0xi' : target_HC32F4A0.HC32F4A0xI,
'hc32f4a0' : target_HC32F4A0.HC32F4A0xI,
'hc32a4a0xi' : target_HC32F4A0.HC32F4A0xI,
'hc32a4a0' : target_HC32F4A0.HC32F4A0xI,
'hc32f4a2xi' : target_HC32F4A0.HC32F4A0xI,
'hc32f4a2' : target_HC32F4A0.HC32F4A0xI,
'hc32m423xa' : target_HC32M423.HC32M423xA,
'hc32f120x6' : target_HC32x120.HC32F120x6TA,
'hc32f120x8' : target_HC32x120.HC32F120x8TA,
'hc32m120' : target_HC32x120.HC32M120,
'hc32f120' : target_HC32x120.HC32F120x8TA,
'hc32m120x6' : target_HC32x120.HC32M120,
'hc32m120' : target_HC32x120.HC32M120,
'hc32f115x8' : target_HC32F115.HC32F115x8,
'hc32f115' : target_HC32F115.HC32F115x8,
'hc32f155xa' : target_HC32F155.HC32F155xA,
'hc32f155xc' : target_HC32F155.HC32F155xC,
'hc32f155' : target_HC32F155.HC32F155xC,
'hc32f160xa' : target_HC32F160.HC32F160xA,
'hc32f160xc' : target_HC32F160.HC32F160xC,
'hc32f160' : target_HC32F160.HC32F160xC,
'hc32l110' : target_HC32L110.HC32L110,
'hc32f003' : target_HC32L110.HC32F003,
'hc32f005' : target_HC32L110.HC32F005,
Expand Down
108 changes: 108 additions & 0 deletions pyocd/target/builtin/target_HC32F115.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# pyOCD debugger
# Copyright (c) 2024 Huada Semiconductor Corporation
# 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)
from ...debug.svd.loader import SVDFile


class DBGMCU:
MCUSTPCTL = 0x40015004
MCUSTPCTL_VALUE = 0x09


FLASH_ALGO = {
'load_address' : 0x20000000,

# Flash algorithm as a hex string
'instructions': [
0xE00ABE00,
0x4770ba40, 0x4770ba40, 0x4770ba40, 0x4770bac0, 0x4770bac0, 0x4770bac0, 0x49022001, 0x49026088,
0x47707088, 0x40000800, 0x40000a80, 0xf000b510, 0xbd10f817, 0x4604b510, 0xf0004620, 0xbd10f845,
0x49052000, 0x608860c8, 0x49042007, 0x20007088, 0x490143c0, 0x47706008, 0x40000800, 0x40000a80,
0x2400b510, 0x49162001, 0x460860c8, 0x21ff68c0, 0x43083151, 0x60c84912, 0x60002000, 0x1c64e007,
0x42844810, 0xf000d303, 0x2001f945, 0x480cbd10, 0x21ff6900, 0x40083101, 0xd1f04288, 0x4808e005,
0x21106940, 0x49064308, 0x48056148, 0x21106900, 0x28004008, 0x4902d1f3, 0xbf0060c8, 0x0000e7e6,
0x40000800, 0x00061a80, 0x4604b570, 0xf0002500, 0x2001f921, 0x60c84915, 0x68c04608, 0x314121ff,
0x49124308, 0x200060c8, 0xe0076020, 0x48101c6d, 0xd3034285, 0xf90ef000, 0xbd702001, 0x6900480b,
0x310121ff, 0x42884008, 0xe005d1f0, 0x69404807, 0x43082110, 0x61484905, 0x69004804, 0x40082110,
0xd1f32800, 0x60c84901, 0xe7e6bf00, 0x40000800, 0x00061a80, 0x20ffb510, 0x49033024, 0x48036008,
0xf7ff6008, 0xbd10ff69, 0x40000800, 0x00003210, 0xb082b5f7, 0x2000460c, 0x9f049001, 0xf8daf000,
0x49432001, 0x460860c8, 0x21ff68c0, 0x43083131, 0x60c8493f, 0x26009d02, 0x6838e026, 0x20006028,
0xe00b9001, 0x1c409801, 0x493a9001, 0x42889801, 0xf000d304, 0x2001f8bf, 0xbdf0b005, 0x69004834,
0x40082110, 0xd1ed2810, 0x4831e005, 0x21106940, 0x492f4308, 0x482e6148, 0x21106900, 0x28104008,
0x1d3fd0f3, 0x1c761d2d, 0x42b008a0, 0x07a0d8d5, 0x28000f80, 0x9700d030, 0xe0282600, 0x78009800,
0x20007028, 0xe00a9001, 0x1c409801, 0x49219001, 0x42889801, 0xf000d303, 0x2001f88d, 0x481ce7cc,
0x21106900, 0x28104008, 0xe005d1ee, 0x69404818, 0x43082110, 0x61484916, 0x69004815, 0x40082110,
0xd0f32810, 0x1c409800, 0x1c6d9000, 0x07a01c76, 0x42b00f80, 0xbf00d8d2, 0x490d2000, 0x900160c8,
0x9801e00a, 0x90011c40, 0x9801490a, 0xd3034288, 0xf860f000, 0xe79f2001, 0x69004805, 0x310121ff,
0x42884008, 0xf000d1ed, 0x2000f855, 0x0000e794, 0x40000800, 0x00009c40, 0x4604b570, 0x4616460d,
0xff58f7ff, 0xbd702000, 0x4604b570, 0x4616460d, 0x46294632, 0xf7ff4620, 0xbd70ff5b, 0x49034802,
0x48036088, 0x47706088, 0xffff0123, 0x4000cc00, 0xffff3210, 0x4604b510, 0xfec2f7ff, 0xbd102000,
0x4603b5f8, 0x2100460c, 0x20002600, 0x461e9000, 0xe0062500, 0x6817ce01, 0xd00042b8, 0x1d12e004,
0x08a01c6d, 0xd8f542a8, 0x9600bf00, 0xe0082100, 0x78079800, 0x90001c40, 0x42875c50, 0xe004d000,
0x07a01c49, 0x42880f80, 0xbf00d8f2, 0x18c000a8, 0xbdf81840, 0x4804b510, 0x07c06800, 0x28000fc0,
0xf000d101, 0xbd10f803, 0x40000a80, 0x4823b570, 0xb2846840, 0x68004822, 0x4008210c, 0x48200886,
0x210f6800, 0x40080209, 0x2e000a05, 0x11a4d101, 0x2e01e008, 0x12a4d101, 0x2e02e004, 0x1324d101,
0x13a4e000, 0xd0012d00, 0xd1022d0f, 0xff96f7ff, 0x07e8e022, 0x28000fc0, 0x2c00d004, 0xf7ffd11c,
0xe019ff8d, 0x40282002, 0xd1042802, 0xd1132c01, 0xff84f7ff, 0x2004e010, 0x28044028, 0x2c02d104,
0xf7ffd10a, 0xe007ff7b, 0x40282008, 0xd1032808, 0xd1012c03, 0xff72f7ff, 0x0000bd70, 0x4000cc00,
0x40000a80, 0x00000000
],

# Relative function addresses
'pc_init': 0x2000027d,
'pc_unInit': 0x200002b9,
'pc_program_page': 0x2000028d,
'pc_erase_sector': 0x20000039,
'pc_eraseAll': 0x20000031,

'static_base' : 0x20000000 + 0x00000004 + 0x000003c4,
'begin_stack' : 0x20000600,
'begin_data' : 0x20000000 + 0xA00,
'page_size' : 0x200,
'analyzer_supported' : False,
'analyzer_address' : 0x00000000,
'page_buffers' : [0x20000A00, 0x20000C00], # Enable double buffering
'min_program_length' : 0x200,

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


class HC32F115x8(CoreSightTarget):

VENDOR = "HDSC"

MEMORY_MAP = MemoryMap(
FlashRegion( start=0x00000000, length=0x10000, page_size=0x200, sector_size=0x200,
is_boot_memory=True,
algo=FLASH_ALGO),
RamRegion( start=0x20000000, length=0x1000)
)

def __init__(self, session):
super(HC32F115x8, self).__init__(session, self.MEMORY_MAP)
self._svd_location = SVDFile.from_builtin("HC32F115.svd")

def post_connect_hook(self):
self.write32(DBGMCU.MCUSTPCTL, DBGMCU.MCUSTPCTL_VALUE)

199 changes: 199 additions & 0 deletions pyocd/target/builtin/target_HC32F155.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# pyOCD debugger
# Copyright (c) 2024 Huada Semiconductor Corporation
# 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)
from ...debug.svd.loader import SVDFile


class DBGMCU:
MCUSTPCTL = 0x40015004
MCUSTPCTL_VALUE = 0x09


FLASH_ALGO = {
'load_address' : 0x20000000,

# Flash algorithm as a hex string
'instructions': [
0xE00ABE00,
0x4770ba40, 0x4770ba40, 0x4770ba40, 0x4770bac0, 0x4770bac0, 0x4770bac0, 0x49022001, 0x49026088,
0x47707088, 0x40000800, 0x40000a80, 0xf000b510, 0xbd10f819, 0x4604b510, 0xf0004620, 0xbd10f847,
0x49062000, 0x200260c8, 0x20076088, 0x70884904, 0x43c02000, 0x60084901, 0x00004770, 0x40000800,
0x40000a80, 0x2400b510, 0x49162001, 0x460860c8, 0x21ff68c0, 0x43083151, 0x60c84912, 0x60002000,
0x1c64e007, 0x42844810, 0xf000d303, 0x2001f945, 0x480cbd10, 0x21ff6900, 0x40083101, 0xd1f04288,
0x4808e005, 0x21106940, 0x49064308, 0x48056148, 0x21106900, 0x28004008, 0x4902d1f3, 0xbf0060c8,
0x0000e7e6, 0x40000800, 0x00061a80, 0x4604b570, 0xf0002500, 0x2001f921, 0x60c84915, 0x68c04608,
0x314121ff, 0x49124308, 0x200060c8, 0xe0076020, 0x48101c6d, 0xd3034285, 0xf90ef000, 0xbd702001,
0x6900480b, 0x310121ff, 0x42884008, 0xe005d1f0, 0x69404807, 0x43082110, 0x61484905, 0x69004804,
0x40082110, 0xd1f32800, 0x60c84901, 0xe7e6bf00, 0x40000800, 0x00061a80, 0x20ffb510, 0x49033024,
0x48036008, 0xf7ff6008, 0xbd10ff67, 0x40000800, 0x00003210, 0xb082b5f7, 0x2000460c, 0x9f049001,
0xf8daf000, 0x49432001, 0x460860c8, 0x21ff68c0, 0x43083131, 0x60c8493f, 0x26009d02, 0x6838e026,
0x20006028, 0xe00b9001, 0x1c409801, 0x493a9001, 0x42889801, 0xf000d304, 0x2001f8bf, 0xbdf0b005,
0x69004834, 0x40082110, 0xd1ed2810, 0x4831e005, 0x21106940, 0x492f4308, 0x482e6148, 0x21106900,
0x28104008, 0x1d3fd0f3, 0x1c761d2d, 0x42b008a0, 0x07a0d8d5, 0x28000f80, 0x9700d030, 0xe0282600,
0x78009800, 0x20007028, 0xe00a9001, 0x1c409801, 0x49219001, 0x42889801, 0xf000d303, 0x2001f88d,
0x481ce7cc, 0x21106900, 0x28104008, 0xe005d1ee, 0x69404818, 0x43082110, 0x61484916, 0x69004815,
0x40082110, 0xd0f32810, 0x1c409800, 0x1c6d9000, 0x07a01c76, 0x42b00f80, 0xbf00d8d2, 0x490d2000,
0x900160c8, 0x9801e00a, 0x90011c40, 0x9801490a, 0xd3034288, 0xf860f000, 0xe79f2001, 0x69004805,
0x310121ff, 0x42884008, 0xf000d1ed, 0x2000f855, 0x0000e794, 0x40000800, 0x00009c40, 0x4604b570,
0x4616460d, 0xff58f7ff, 0xbd702000, 0x4604b570, 0x4616460d, 0x46294632, 0xf7ff4620, 0xbd70ff5b,
0x49034802, 0x48036088, 0x47706088, 0xffff0123, 0x4000cc00, 0xffff3210, 0x4604b510, 0xfec0f7ff,
0xbd102000, 0x4603b5f8, 0x2100460c, 0x20002600, 0x461e9000, 0xe0062500, 0x6817ce01, 0xd00042b8,
0x1d12e004, 0x08a01c6d, 0xd8f542a8, 0x9600bf00, 0xe0082100, 0x78079800, 0x90001c40, 0x42875c50,
0xe004d000, 0x07a01c49, 0x42880f80, 0xbf00d8f2, 0x18c000a8, 0xbdf81840, 0x4804b510, 0x07c06800,
0x28000fc0, 0xf000d101, 0xbd10f803, 0x40010680, 0x4823b570, 0xb2846840, 0x68004822, 0x4008210c,
0x48200886, 0x210f6800, 0x40080209, 0x2e000a05, 0x11a4d101, 0x2e01e008, 0x12a4d101, 0x2e02e004,
0x1324d101, 0x13a4e000, 0xd0012d00, 0xd1022d0f, 0xff96f7ff, 0x07e8e022, 0x28000fc0, 0x2c00d004,
0xf7ffd11c, 0xe019ff8d, 0x40282002, 0xd1042802, 0xd1132c01, 0xff84f7ff, 0x2004e010, 0x28044028,
0x2c02d104, 0xf7ffd10a, 0xe007ff7b, 0x40282008, 0xd1032808, 0xd1012c03, 0xff72f7ff, 0x0000bd70,
0x4000cc00, 0x40010680, 0x00000000
],

# Relative function addresses
'pc_init': 0x20000281,
'pc_unInit': 0x200002bd,
'pc_program_page': 0x20000291,
'pc_erase_sector': 0x20000039,
'pc_eraseAll': 0x20000031,

'static_base' : 0x20000000 + 0x00000004 + 0x000003c8,
'begin_stack' : 0x20000600,
'begin_data' : 0x20000000 + 0x1000,
'page_size' : 0x200,
'analyzer_supported' : False,
'analyzer_address' : 0x00000000,
'page_buffers' : [0x20001000, 0x20001200], # Enable double buffering
'min_program_length' : 0x200,

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


FLASH_ALGO_NVR = {
'load_address' : 0x20000000,

# Flash algorithm as a hex string
'instructions': [
0xE00ABE00,
0x4770ba40, 0x4770ba40, 0x4770ba40, 0x4770bac0, 0x4770bac0, 0x4770bac0, 0x49022001, 0x49026088,
0x47707088, 0x40000800, 0x40000a80, 0xf000b510, 0xbd10f819, 0x4604b510, 0xf0004620, 0xbd10f86b,
0x49062000, 0x200260c8, 0x20076088, 0x70884904, 0x43c02000, 0x60084901, 0x00004770, 0x40000800,
0x40000a80, 0x2400b510, 0x49262001, 0x460860c8, 0x21ff68c0, 0x43083141, 0x60c84922, 0x49222000,
0xe0076008, 0x48211c64, 0xd3034284, 0xf968f000, 0xbd102001, 0x6900481b, 0x310121ff, 0x42884008,
0xe005d1f0, 0x69404817, 0x43082110, 0x61484915, 0x69004814, 0x40082110, 0xd1f32800, 0x60084914,
0x1c64e007, 0x42844811, 0xf000d303, 0x2001f949, 0x480ce7df, 0x21ff6900, 0x40083101, 0xd1f04288,
0x4808e005, 0x21106940, 0x49064308, 0x48056148, 0x21106900, 0x28004008, 0x4902d1f3, 0xbf0060c8,
0x0000e7c7, 0x40000800, 0x01000800, 0x00061a80, 0x01000a00, 0x4604b570, 0xf0002500, 0x2001f921,
0x60c84915, 0x68c04608, 0x314121ff, 0x49124308, 0x200060c8, 0xe0076020, 0x48101c6d, 0xd3034285,
0xf90ef000, 0xbd702001, 0x6900480b, 0x310121ff, 0x42884008, 0xe005d1f0, 0x69404807, 0x43082110,
0x61484905, 0x69004804, 0x40082110, 0xd1f32800, 0x60c84901, 0xe7e6bf00, 0x40000800, 0x00061a80,
0x20ffb510, 0x49033024, 0x48036008, 0xf7ff6008, 0xbd10ff43, 0x40000800, 0x00003210, 0xb082b5f7,
0x2000460c, 0x9f049001, 0xf8daf000, 0x49432001, 0x460860c8, 0x21ff68c0, 0x43083131, 0x60c8493f,
0x26009d02, 0x6838e026, 0x20006028, 0xe00b9001, 0x1c409801, 0x493a9001, 0x42889801, 0xf000d304,
0x2001f8bf, 0xbdf0b005, 0x69004834, 0x40082110, 0xd1ed2810, 0x4831e005, 0x21106940, 0x492f4308,
0x482e6148, 0x21106900, 0x28104008, 0x1d3fd0f3, 0x1c761d2d, 0x42b008a0, 0x07a0d8d5, 0x28000f80,
0x9700d030, 0xe0282600, 0x78009800, 0x20007028, 0xe00a9001, 0x1c409801, 0x49219001, 0x42889801,
0xf000d303, 0x2001f88d, 0x481ce7cc, 0x21106900, 0x28104008, 0xe005d1ee, 0x69404818, 0x43082110,
0x61484916, 0x69004815, 0x40082110, 0xd0f32810, 0x1c409800, 0x1c6d9000, 0x07a01c76, 0x42b00f80,
0xbf00d8d2, 0x490d2000, 0x900160c8, 0x9801e00a, 0x90011c40, 0x9801490a, 0xd3034288, 0xf860f000,
0xe79f2001, 0x69004805, 0x310121ff, 0x42884008, 0xf000d1ed, 0x2000f855, 0x0000e794, 0x40000800,
0x00009c40, 0x4604b570, 0x4616460d, 0xff58f7ff, 0xbd702000, 0x4604b570, 0x4616460d, 0x46294632,
0xf7ff4620, 0xbd70ff5b, 0x49034802, 0x48036088, 0x47706088, 0xffff0123, 0x4000cc00, 0xffff3210,
0x4604b510, 0xfe9cf7ff, 0xbd102000, 0x4603b5f8, 0x2100460c, 0x20002600, 0x461e9000, 0xe0062500,
0x6817ce01, 0xd00042b8, 0x1d12e004, 0x08a01c6d, 0xd8f542a8, 0x9600bf00, 0xe0082100, 0x78079800,
0x90001c40, 0x42875c50, 0xe004d000, 0x07a01c49, 0x42880f80, 0xbf00d8f2, 0x18c000a8, 0xbdf81840,
0x4804b510, 0x07c06800, 0x28000fc0, 0xf000d101, 0xbd10f803, 0x40010680, 0x4823b570, 0xb2846840,
0x68004822, 0x4008210c, 0x48200886, 0x210f6800, 0x40080209, 0x2e000a05, 0x11a4d101, 0x2e01e008,
0x12a4d101, 0x2e02e004, 0x1324d101, 0x13a4e000, 0xd0012d00, 0xd1022d0f, 0xff96f7ff, 0x07e8e022,
0x28000fc0, 0x2c00d004, 0xf7ffd11c, 0xe019ff8d, 0x40282002, 0xd1042802, 0xd1132c01, 0xff84f7ff,
0x2004e010, 0x28044028, 0x2c02d104, 0xf7ffd10a, 0xe007ff7b, 0x40282008, 0xd1032808, 0xd1012c03,
0xff72f7ff, 0x0000bd70, 0x4000cc00, 0x40010680, 0x00000000
],

# Relative function addresses
'pc_init': 0x200002c9,
'pc_unInit': 0x20000305,
'pc_program_page': 0x200002d9,
'pc_erase_sector': 0x20000039,
'pc_eraseAll': 0x20000031,

'static_base' : 0x20000000 + 0x00000004 + 0x00000410,
'begin_stack' : 0x20000700,
'begin_data' : 0x20000000 + 0x1000,
'page_size' : 0x200,
'analyzer_supported' : False,
'analyzer_address' : 0x00000000,
'page_buffers' : [0x20001000, 0x20001200], # Enable double buffering
'min_program_length' : 0x200,

# Flash information
'flash_start': 0x1000800,
'flash_size': 0x400,
'sector_sizes': (
(0x0, 0x200),
)
}


class HC32F155xA(CoreSightTarget):

VENDOR = "HDSC"

MEMORY_MAP = MemoryMap(
FlashRegion( start=0x00000000, length=0x20000, page_size=0x200, sector_size=0x200,
is_boot_memory=True,
algo=FLASH_ALGO),
FlashRegion( start=0x01000800, length=0x400, page_size=0x200, sector_size=0x200,
is_boot_memory=False,
is_default=False,
algo=FLASH_ALGO_NVR),
RamRegion( start=0x20000000, length=0x8000)
)

def __init__(self, session):
super(HC32F155xA, self).__init__(session, self.MEMORY_MAP)
self._svd_location = SVDFile.from_builtin("HC32F155.svd")

def post_connect_hook(self):
self.write32(DBGMCU.MCUSTPCTL, DBGMCU.MCUSTPCTL_VALUE)

class HC32F155xC(CoreSightTarget):

VENDOR = "HDSC"

MEMORY_MAP = MemoryMap(
FlashRegion( start=0x00000000, length=0x40000, page_size=0x200, sector_size=0x200,
is_boot_memory=True,
algo=FLASH_ALGO),
FlashRegion( start=0x01000800, length=0x400, page_size=0x200, sector_size=0x200,
is_boot_memory=False,
is_default=False,
algo=FLASH_ALGO_NVR),
RamRegion( start=0x20000000, length=0x8000)
)

def __init__(self, session):
super(HC32F155xC, self).__init__(session, self.MEMORY_MAP)
self._svd_location = SVDFile.from_builtin("HC32F155.svd")

def post_connect_hook(self):
self.write32(DBGMCU.MCUSTPCTL, DBGMCU.MCUSTPCTL_VALUE)
Loading

0 comments on commit 999eb4a

Please sign in to comment.