WIP mik32 sections

This commit is contained in:
Sergey Shchelkanov 2023-05-11 12:54:47 +03:00
parent 65faf0eb22
commit 280cc95c44
2 changed files with 23 additions and 6 deletions

View File

@ -2,7 +2,7 @@ from typing import List, Dict
from dataclasses import dataclass from dataclasses import dataclass
from enum import Enum from enum import Enum
from typing import List, Tuple from typing import List
class RecordType(Enum): class RecordType(Enum):

View File

@ -4,7 +4,7 @@ import sys
import subprocess import subprocess
import os import os
from enum import Enum from enum import Enum
from typing import List, Tuple from typing import List, NamedTuple
from drivers.tclrpc import OpenOcdTclRpc from drivers.tclrpc import OpenOcdTclRpc
from drivers.mik32_eeprom import * from drivers.mik32_eeprom import *
from drivers.mik32_spifi import * from drivers.mik32_spifi import *
@ -42,6 +42,24 @@ class Segment:
offset: int offset: int
data: List[int] data: List[int]
class MemoryType(Enum):
EEPROM = 1
RAM = 2
SPIFI = 80
class MemorySection(NamedTuple):
type: MemoryType
offset: int
length: int # Memory section length in bytes
mik32v0_sections: List[MemorySection] = [
MemorySection(MemoryType.EEPROM, 0x01000000, 8 * 1024),
MemorySection(MemoryType.RAM, 0x02000000, 8 * 1024),
MemorySection(MemoryType.SPIFI, 0x80000000, 8 * 1024 * 1024),
]
def read_file(filename: str) -> List[Segment]: def read_file(filename: str) -> List[Segment]:
segments: List[Segment] = [] segments: List[Segment] = []
lines: List[str] = [] lines: List[str] = []
@ -79,7 +97,6 @@ def read_file(filename: str) -> List[Segment]:
elif record.type == RecordType.LINEARSTARTADDR: elif record.type == RecordType.LINEARSTARTADDR:
print("Start Linear Address:", record.address) print("Start Linear Address:", record.address)
return segments return segments