pyocd / pyOCD

Open source Python library for programming and debugging Arm Cortex-M microcontrollers
https://pyocd.io
Apache License 2.0
1.13k stars 484 forks source link

Support for Samsung S111 target and S5JS100 board needed #604

Closed andrewc-arm closed 4 years ago

andrewc-arm commented 5 years ago

Description

Please add support for debugging S5JS100 (id: 3701) with pyOCD. This would enable debugging with Eclipse, GDB Server, and scripting with Python.

Requirements

Flash Algorithm

Here is FlashAlgo of S5JS100. py_blob.zip

flash_algo = {

    # Flash algorithm as a hex string
    'instructions':
        "fe490a280ad18a6912f0807ffbd18a6912f47f0ffbd10d2281f820208a6912f0"
        "807ffbd18a6912f47f0ffbd181f82000704728b1026811700168491c01607047"
        "cab2ee480a2a0ad1816911f0807ffbd1816911f47f0ffbd10d2180f820108169"
        "11f0807ffbd1816911f47f0ffbd180f8202070472de9f041141e0e4680464ff0"
        "00054ff0200710dd32780021304622b110f8012f491c002afad1a142acbf0024"
        "641a13f0020f18bf302713f0010f09d1002c07dd39464046fff7bbff641e6d1c"
        "002cf7dc307840b1c1b24046fff7b1ff16f8010f6d1c0028f6d1002c07dd3946"
        "4046fff7a6ff641e6d1c002cf7dc2846bde8f0812de9f04583b09c468046dde9"
        "0b7300200a9e0546824629b1bcf1000f16d00a2a0ed013e030208df800008df8"
        "01a03b46324669464046fff7a3ff03b0bde8f085b1f1000cbcbf0120ccf10001"
        "0df10b048df80ba089b1b1fbf2fc02fb1c1cbcf10a0fa4bf9c44acf13a0c0cf1"
        "300cb1fbf2f104f801cd0029edd178b1002e18bf17f0020f07d04ff02d014046"
        "fff757ff6d1c761e02e02d2004f8010d3b46324621464046fff76cff03b02844"
        "bde8f0850fb42de9f04d84b000270c9c3e460dad2078002875d04ff0410b4ff0"
        "6108ba46c0b225287bd1002214f8010f134600287fd0252873d02d2804bf0123"
        "641c2078302805d114f8010f43f002033028f9d0c0b2303809280ad802eb8200"
        "400014f8011b30380a18207830380928f4d9207873280ad0642811d078281cd0"
        "582827d0752832d063283fd04ee055f8041b002908bf72a13846fff71bff24e0"
        "cde90023cdf8088055f8041b01230a223846fff74fff064438e0cde90023cdf8"
        "088055f8041b002310223846fff742ff06442be0cde90023cdf808b055f8041b"
        "002310223846fff735ff06441ee0cde90023cdf8088055f8041b00230a223846"
        "fff728fff1e71be00be014e015f8040b8df80c008df80da003a93846fff7dafe"
        "e3e7c1b23846fff7b4fe761c14f8010f00287ff477af002f1cbf386880f800a0"
        "304604b0bde8f00d5df814fb036823ea010111430160704700218142b8bf491c"
        "fbdb704740494ff4c64041f8700f48608860c860086148613c48012141670021"
        "81673b49416070474ff0024239483b49c2f8000138480860394900120860091d"
        "0012086037490860091d4ff0013008600a210020401c8842fcdb334836214162"
        "102181627021c16240f201310163552101602e480a21c2f800010020401c8842"
        "fcdb70472b492a48086070472a490020086070472de9f047fff7c6ffdff89c80"
        "012316480025184ac8f8383047f20131c0f8c450c2f83011c2f83411c0e90235"
        "4ff0060cc0e904c5c0e90653032643f285374ff00244c0e90067d4f8004114f0"
        "004f4ff0040419bf4ff4a16ac0e90aa34ff0a80ac0e90aa422e0000000500183"
        "286e756c6c29000000100282000002850a806086010d90c101000001040a0082"
        "000a0083000a008500400285110d90c10002040014ed00e00010018300100485"
        "85634ff0070ac0f8c430c8f83830c0f8c450c2f83011c2f834110660476040f2"
        "21218160c560c0f810c045618561c3616a218162c0f82cc004634463c563c0f8"
        "08a064210020401c8842fcdb4ff4c640106750679067d067c2f88000374cc2f8"
        "840037486060c4e91d3536a0fff77afe94f8dc0010f0010ffad13448606094f8"
        "dc0010f0010ffad131a0fff76bfe324833490560314808600020bde8f0872749"
        "10b53048486030a0fff75cfe002010bd10b52fa0fff756fe20493048486030a0"
        "fff750fe002010bd10b5044601462ea0fff748fe194a92f8dc3013f0010ffad1"
        "1461ff2082f85e0064210020401c8842fcdb92f8dc0010f0010ffad120a0fff7"
        "31fe002010bd70b5154600f1a0440e460a46214622a0fff725fe084917484860"
        "f01c30f0030005d055f8042b44f8042b001ff9d105484860002070bd00000285"
        "0a806086496e69740a0000001a066006446f6e650a0000000010018300020400"
        "14ed00e00a866006556e696e69740a00455241534520434849500a001a066086"
        "444f4e450a0000003120455241534520534543544f522c20307825780a000000"
        "50726f6772616d206164723d307825782c20737a3d307825780a000000000000",

    # Relative function addresses
    'pc_init': 0x395,
    'pc_unInit': 0x4df,
    'pc_program_page': 0x547,
    'pc_erase_sector': 0x509,
    'pc_eraseAll': 0x4f1,

    # Relative region addresses and sizes
    'ro_start': 0x0,
    'ro_size': 0x5fc,
    'rw_start': 0x5fc,
    'rw_size': 0x4,
    'zi_start': 0x600,
    'zi_size': 0x0,

    # Flash information
    'flash_start': 0x406f4000,
    'flash_size': 0x100000,
    'page_size': 0x400,
    'sector_sizes': (
        (0x0, 0x80000),
    )
}

Reference

(CC: @flit, @0xc0170 )

flit commented 5 years ago

Thanks! I forgot the name of the S111 board was S5JS100, so I was thinking it might be a different MCU. 😄

andrewc-arm commented 5 years ago

Hi, @flit

From this file: https://github.com/ARMmbed/mbed-os-rjio/blob/25be2e52948409727f29d353637beb28c9b2f192/targets/TARGET_Samsung/S111_FW_Write_190103_mbed.zip

There is OpenOCD way to debug as S111_FW_Write_190103_mbed\OpenOCD\openocd\windows_64\fusing_dbg.bat This enables OpenOCD debugging. Any chance you can reference that OpenOCD example and make it work for PyOCD?

If you need S111 reference manual, any chance you can elaborate which information is needed? As far as I know, Samsung may not be able to provide the reference manual but is able to answer any HW/embedded related questions.

flit commented 5 years ago

Thanks, I'll look.

We require that the reference manual be publicly available for any device added to pyOCD (or DAPLink), since this is an open source project. Anyone in the community should be able to see where the target support data came from.

As far as information from the RM, I need the detailed block diagram, memory map, and debug architecture details. Often other information is useful, but you don't know until you start testing and debugging.

flit commented 5 years ago

The OpenOCD scripts help, but I need the reference manual to understand what they are doing and why. For instance, what does the cmu_init routine do? What registers is it writing, and why? I need to be able to distinguish between code in the OpenOCD scripts that is required for basic target connection and control, versus code used for flashing the firmware. The latter would be handled by an external script, not part of pyOCD itself.

flit commented 5 years ago

Hi @andrewc-arm , I'll also need an SVD file for the S111.

andrewc-arm commented 5 years ago

Hi, @flit

I searched about how to create SVD file. This is the file type you are looking for? https://www.keil.com/pack/doc/CMSIS/SVD/html/svd_Format_pg.html

I will discuss with Samsung on creating this file. Do you have any tips on creating this file? Do you think SVD is related with CMSIS-Pack?

Without the reference manual and SVD file, do you think you can still proceed or are you blocked to proceed with this S111 + pyOCD enablement?

Thanks!

andrewc-arm commented 5 years ago

Hi, @jh6186 We might need your assistance on getting these files to enable pyOCD + S111.

Thanks,

jh6186 commented 5 years ago

Hi,

We already shared S111 reference manual, kimmo or joseph may get this long ago. please double check. and what is SVD file?

flit commented 5 years ago

The link @andrewc-arm provided above documents the SVD file format. It is a standard format in the Cortex-M ecosystem for describing memory mapped registers. All Cortex-M debuggers support this format, and it will shortly become a requirement for pyOCD target support.

andrewc-arm commented 5 years ago

Hi, @jh6186 There are Arm Keil related tools at this location. https://github.com/ARM-software/CMSIS_5/tree/develop/CMSIS/Utilities/Win32 I observe that SVDConv.exe is there.

flit commented 5 years ago

@jh6186 SVD is the standard format for memory mapped register definitions in the Arm ecosystem. Pretty much all debuggers support this format. The docs are here: http://arm-software.github.io/CMSIS_5/SVD/html/index.html.

With #618, all new builtin targets in pyOCD need an SVD file.

andrewc-arm commented 5 years ago

Hi, @flit Since Samsung provided us way to debug with OpenOCD + DAPLink. There is no urgent need for this enablement. If possible, could you please consider this issue instead? https://github.com/ARMmbed/Samsung_projects/issues/3 Thanks!

40Grit commented 5 years ago

@andrewc-arm

If I'm not mistaken standard headers for the memory mapped peripherals are also generated from the .svd does this target not have cmsis files generated?

I'd assume it would be a bit hard to have mbed os support unless the standard headers were generated.

It would not bode well to me if Samsung truly didn't know about .svd.

juhhov commented 5 years ago

Hi @flit, @0xc0170

What are the current plans with this board? Is there ongoing to effort to support it? Thanks.

andrewc-arm commented 5 years ago

Hi, @juhhov In the separate discussion, @flit and @0xc0170 mentioned that we need a CMSIS-pack from Samsung. Unfortunately, they are not ready yet. When they get it ready, maybe we can resume this ticket.

RomanSaveljev commented 5 years ago

@andrewc-arm I can read from the comments above that Samsung has provided a way to debug through OpenOCD. Is there any intention to provide a pack, which will essentially enable the same feature, but with pyOCD?

andrewc-arm commented 5 years ago

Hi, @RomanSaveljev I answered some of your question from our JIRA case. Besides, having an exception for Mbed-OS target is a bit confusing to the user. Having same integrity of Mbed target => pyOCD debugging is simpler.

40Grit commented 5 years ago

New pyOCD?

andrewc-arm commented 5 years ago

@40Grit I just updated my previous comment about 'new pyOCD'. It was found to be incorrect. 😊

0xc0170 commented 4 years ago

I set this in progress, making progress to enable this one.

40Grit commented 4 years ago

Do they have their packs in order now?

andrewc-arm commented 4 years ago

Hi. The pack is ready but the Samsung team is going through legal checks on the pack if it can be publicized. The pack is available in Arm for now.

0Grit commented 4 years ago

@flit @andrewc-arm I beleive this can be closed?