Flasher/How to read data from a device using U-Flash

From SEGGER Wiki
Jump to: navigation, search

This wiki article describes how to read back data from a device using U-Flash. For Information on how to read back data with J-Flash, please refer to the J-Flash Manual.

U-Flash Configuration

In order to read back data from a device, readback support needs to be available for the selected device. Open the File menu in the menu bar and check whether File -> Generate data file for read... is grayed out. If it is not grayed out, readback is supported for the selected device.

Select Generate a data file for read...'.

Next, if readback support is available, we need to create a data file for reading the device. This is because the Flasher reads only sections that are available in the data file. The actual content of the data in the data file is irrelevant.

A data file for reading back data can be created via File -> Generate data file for read... which will open a new window that asks you to select all flash banks that the new data file should contain. The difference between Generate data file for read... and Generate test data file... is that when generating a data file for read, flash banks that cannot be read from cannot be selected, and flash banks that can be read from but may lock the device if written to the device can be selected. Thus, a data file for read should never be used to write data to the device, as this might lock the device. Furthermore, in the data file for read all data is set to 1's whereas the test data file contains random data.

Generate a data file for read by selecting all flash banks to read from.

Now, select all flash banks you want to read back and press OK. The new data file is automatically selected by U-Flash. If desired, the generated data file can be edited by hand to decrease the size of the data read from a specific flash bank. Please note, that the smallest chunk of data that can be read from a flash bank is the sector size specified for the flash bank in the Device Definition File. Finally, copy the data file via U-Flash onto the Flasher.

Performing the readback

Open a Telnet connection to the Flasher, since the read data is sent by the Flasher to the Host via Telnet. Send the #read command to perform a readback. Using #auto or the PROG button is not possible for reading back data. The read data is sent to you using the S3-record file format. See also: https://en.wikipedia.org/wiki/SREC_(file_format)

J-Link / Flasher PRO V5-1 telnet-shell.
J-Link / Flasher PRO V5-1 compiled Jul 20 2023 12:03:38
#read
#ACK
#STATUS:INITIALIZING
#STATUS:CONNECTING
#INFO:Verbosity: none
#INFO:20230810 P16F151X.PEX
#INFO:PIC16F1937
#STATUS:READING
#DATA:S32500000000F825B711F81127151431732D120256191539F5024A28BF3DC4008B129F22FA1168
#DATA:S32500000020BF3FEC3BF12C5401FA34F73CD01C8C356431CF2630082D0F89254E2D3B22203A37
#DATA:S325000000403329A9151D168C3B292234040019D92EBB0A6F20C42CDC08F2083621203C120CF0
#DATA:S32500000060D726F1236D2EF915ED084A11113D16348F25F33B141B6420CC162404FC38C81528
#DATA:S32500000080F52C63250724133DEC3466235E0AA90F7A3E380C073FC0064B341219A027060AE4
#DATA:S325000000A01A287D081104B0103E07A510183930374E0CDC3CB00F4F3A3736F923CA0058394E
#DATA:S325000000C0FF1E421663285F0C75371B1C21075621EA109C14540C5F0F5D3541379216810B77
#DATA:S325000000E057296D39E909F429C9172B13A038412CC1059103B62D4B1C8808C33677188B1308
#DATA:S325000001008A18DE1B861F180C4424022F2C133905401C90241D2063019C092522B100250EDE
#DATA:S32500000120D81BB43B5B2E153A590146035C1CB82FB71E2B16BB0F2B2F803D54253613123002
#DATA:S32500000140E402570A0728773F463B63376512E31DC625D705C326153DAD2BD53F7639053603
#DATA:S325000001607315AA215D0B86183E1A09343307BC2153062F0C1C3160002C1A633D552BA42306
#DATA:S325000001804214770CED292D21360E7F189D336203BF057D2DD11D721F2737040F030D2A3D37
#DATA:S325000001A0500BF210242E280B1C098B37150CB32FDA146A0E4E1B153D29288B050737700BB2
#DATA:S325000001C0611EAE32FA29D92BA10EF731633EE701531C3E29FE2B8D13B605F93CBF24BF20E2
#DATA:S325000001E0BB3B28206E211A3AB03D320ED72D191C1A256438F91B331F121CC408F62FC01E34
#DATA:S32500000200B409E40DD314D33E0215871C8423CC0C1C3AE41C5B3BCF09E204780E2B218E10DF
#DATA:S325000002204A329C05BC3BAA15A42390089D18990C42105907D5223C20540BFA13CC1A8F380E
#DATA:S32500000240650BA2309E3CE60F5E1A481B2C024507DA276B36BC080E0EBA35211B2035ED2F14
#DATA:S32500000260CA3F072F7D3B603B530A76052005BF38B7308424662DD2259C0525187A2BB6019F
#DATA:S325000002803C2F90013E1A4607562EC023AB07302DB504AE28B908C218AA1BE514793DA70BF1
#DATA:S325000002A017239202BE1DC22B4C11B43A80145F253F198C09521D4610902ACE3012042B266E
#DATA:S325000002C0932D3F13A73DFB29DB1A3430FE312118370A4B1DB9330735E23D4E3CAB01920580
#DATA:S325000002E0E80B440B7B1FC5208B373A04EA0CC215A425A23D2B266334E938FB089D030323F0
#DATA:S3250000030017059C2A52043423BB28F02E9E14461CE013A812563AFA0A6E0F55008518280358
#DATA:S325000003209924931EF20ECA21FD038A0CE01E773649065615770EA536032C993A9731A9048C
#DATA:S32500000340E23ECD0AD412843E3723D728C72A452B2E206707AB0790334D0EC03D5D259C0E89
#DATA:S32500000360E718720002374A337513AD3BFC19460AAF192E31A117E62AF60A6F109106A81CB2
#DATA:S3250000038006299601E82DA83B591B3D0DCE39AB0870368B3D2002A023940A960B6F02A61167
#DATA:S325000003A0551D8F38BB1AAB3BE43DBD371A119033BD20AC11C02EE8358A203E24FE331A0A3A
#DATA:S325000003C0390D7F13DD3D58294C0424306108FA2B723B7402182C0714030C4319CC039126FF
#DATA:S325000003E036320D1BB2254406D52D8532A2158C0D8D2A6B11393F8C13EB21C2303708AB30DB
#DATA:S32500000400391D1A38E815142AC42F832BCE355118450ED038AF10ED18B3164C039A19E60610
#DATA:S32500000420D6035512C727EF34302F1D054B0146294D01941D8536DA180A1A913C5B0A3020D7
#DATA:S32500000440E13A7A399918A33AEF158828273DD62F813E8F308F21C61301036E038901CB321A
#DATA:S32500000460AC3C7734501E922BEB0DDD191F25A9070F0C9D018819DF17531DD920D004642CB9
#DATA:S3250000048005012E316F09DB1F1B0B890998016C35BD0B80086C1D4922FE13AB210027D0373E
#DATA:S325000004A0C13187268F18D2399F36400697275E01C2208F1868021B2ED4135928A7173E0607
#DATA:S325000004C0A61DF72F171AF8093321223E3A3CDB397E00D82B462BFA1F990B5D32BC3A56042F
#DATA:S325000004E0C217480BF634161A3C12443C71344E0F4033AD379A223708170E7B29D011573815
#DATA:S325000005001916FC31733F870186337A1A8C09400D922AB51BAD363B3AFF12DB2C1F13CE2EE6
#DATA:S325000005209806992A8C1A073B6C1A850BD61608236100AB314F0FA429D537FB12791A2C30CF
#DATA:S32500000540E027302350329B39AE062214BE34D818D31030388D37242C000B3C0FD424CA02A0
#DATA:S325000005605D18A829FC00F907900BAA220302B401C41B6911CE3CAD1BFE20C72C2B3D0F0C53
#DATA:S3250000058063296C11A42D092E040C3020820AB80C983D9708FB375D25DD254C2B8B08431409
#DATA:S325000005A0E0264E3660370C3CA117B81A5A1CA527F83D9838E42528301D1246343332F42474
#DATA:S325000005C0A22D5625E43D7512CF17FE099323B30C0531A42C6919651A03233020A112820B04
#DATA:S325000005E0C40AA009A30F4C35E70BE72C0B02D217F7035E3A50171D20E61293101C24B20B82
#DATA:S325000006005A28823FBE111C2D2C2F3124C32E142C3C1B02203207E62FB423B11ED910F60943
#DATA:S32500000620400F5E3C650363217502422D2922712F9A0BF92F0B2B9F0D8A300229B410F52E93
#DATA:S32500000640FC233C012611C005E632A00EBF388511C0043D2EAB17BD3F9B110E1126190018DA
#DATA:S325000006606025DD2A6D308A3D6E17B723D522F70D78276906343D4027CC381A0E771B672FF0
#DATA:S32500000680CA2E710E032FBF35260D792F8308EF2B7632B63D39243B184C347D21253B0F0E51
#DATA:S325000006A0543095033B28F5230338B50CE90082066C2C841CC7187621243A630CDA320F2773
#DATA:S325000006C09217451EB311D30ACF08453B2320F72150078D21673D102EEA0BA33E4526192E46
#DATA:S325000006E079380801FD2F072DFA33E325532A391ABF0F4F1AAD33220303250B1DD0079408D6
#DATA:S32500000700533C9C27B92FBF202B071427FF3D89211E270D0ED1025111C516AC0B9014520F3B
#DATA:S32500000720D6218D0D602FCC38BD34540F87106D25F2348202411CD50D7F38E823B81E7B0511
#DATA:S3250000074084118A348C303C3D86163F1F51369E19E210CC248A24F535450AF7303A0D451BFC
#DATA:S325000007600E226A12ED055F382C13F03E162A833F5834521A3F34113E2F30EC120E37CE2A7B
#DATA:S325000007800C2CDB083B33FA3D293B2739C93FE705FE0A2800D415932BBD2C2228F913180CA1
#DATA:S325000007A0C01442147E09C53DB7317F0F120EA429C237EA2EE03E19219E1D3C33D31C2E303D
#DATA:S325000007C0CC3A891E651BAF1CCE021E025619BB3F6B03A723DE08E41447063B1A6D2FBB07AC
#DATA:S325000007E0A51C6A3CAC183D116D0FF81A601A5E0722095328351443012E36D8210B14021547
#OK (Total 0.097s)

However, at the beginning of each line of the read back data, #DATA: is prepended. Copy to read back data into an editor and remove the #DATA: with the "search an replace" function from each line.
Search #DATA: replace with >nothing<
Now you have an S3-record file with the data from the selected flash banks read back from the device.

S32500000000F825B711F81127151431732D120256191539F5024A28BF3DC4008B129F22FA1168
S32500000020BF3FEC3BF12C5401FA34F73CD01C8C356431CF2630082D0F89254E2D3B22203A37
S325000000403329A9151D168C3B292234040019D92EBB0A6F20C42CDC08F2083621203C120CF0
S32500000060D726F1236D2EF915ED084A11113D16348F25F33B141B6420CC162404FC38C81528
S32500000080F52C63250724133DEC3466235E0AA90F7A3E380C073FC0064B341219A027060AE4
S325000000A01A287D081104B0103E07A510183930374E0CDC3CB00F4F3A3736F923CA0058394E
S325000000C0FF1E421663285F0C75371B1C21075621EA109C14540C5F0F5D3541379216810B77
S325000000E057296D39E909F429C9172B13A038412CC1059103B62D4B1C8808C33677188B1308
S325000001008A18DE1B861F180C4424022F2C133905401C90241D2063019C092522B100250EDE
S32500000120D81BB43B5B2E153A590146035C1CB82FB71E2B16BB0F2B2F803D54253613123002
S32500000140E402570A0728773F463B63376512E31DC625D705C326153DAD2BD53F7639053603
S325000001607315AA215D0B86183E1A09343307BC2153062F0C1C3160002C1A633D552BA42306
S325000001804214770CED292D21360E7F189D336203BF057D2DD11D721F2737040F030D2A3D37
S325000001A0500BF210242E280B1C098B37150CB32FDA146A0E4E1B153D29288B050737700BB2
S325000001C0611EAE32FA29D92BA10EF731633EE701531C3E29FE2B8D13B605F93CBF24BF20E2
S325000001E0BB3B28206E211A3AB03D320ED72D191C1A256438F91B331F121CC408F62FC01E34
S32500000200B409E40DD314D33E0215871C8423CC0C1C3AE41C5B3BCF09E204780E2B218E10DF
S325000002204A329C05BC3BAA15A42390089D18990C42105907D5223C20540BFA13CC1A8F380E
S32500000240650BA2309E3CE60F5E1A481B2C024507DA276B36BC080E0EBA35211B2035ED2F14
S32500000260CA3F072F7D3B603B530A76052005BF38B7308424662DD2259C0525187A2BB6019F
S325000002803C2F90013E1A4607562EC023AB07302DB504AE28B908C218AA1BE514793DA70BF1
S325000002A017239202BE1DC22B4C11B43A80145F253F198C09521D4610902ACE3012042B266E
S325000002C0932D3F13A73DFB29DB1A3430FE312118370A4B1DB9330735E23D4E3CAB01920580
S325000002E0E80B440B7B1FC5208B373A04EA0CC215A425A23D2B266334E938FB089D030323F0
S3250000030017059C2A52043423BB28F02E9E14461CE013A812563AFA0A6E0F55008518280358
S325000003209924931EF20ECA21FD038A0CE01E773649065615770EA536032C993A9731A9048C
S32500000340E23ECD0AD412843E3723D728C72A452B2E206707AB0790334D0EC03D5D259C0E89
S32500000360E718720002374A337513AD3BFC19460AAF192E31A117E62AF60A6F109106A81CB2
S3250000038006299601E82DA83B591B3D0DCE39AB0870368B3D2002A023940A960B6F02A61167
S325000003A0551D8F38BB1AAB3BE43DBD371A119033BD20AC11C02EE8358A203E24FE331A0A3A
S325000003C0390D7F13DD3D58294C0424306108FA2B723B7402182C0714030C4319CC039126FF
S325000003E036320D1BB2254406D52D8532A2158C0D8D2A6B11393F8C13EB21C2303708AB30DB
S32500000400391D1A38E815142AC42F832BCE355118450ED038AF10ED18B3164C039A19E60610
S32500000420D6035512C727EF34302F1D054B0146294D01941D8536DA180A1A913C5B0A3020D7
S32500000440E13A7A399918A33AEF158828273DD62F813E8F308F21C61301036E038901CB321A
S32500000460AC3C7734501E922BEB0DDD191F25A9070F0C9D018819DF17531DD920D004642CB9
S3250000048005012E316F09DB1F1B0B890998016C35BD0B80086C1D4922FE13AB210027D0373E
S325000004A0C13187268F18D2399F36400697275E01C2208F1868021B2ED4135928A7173E0607
S325000004C0A61DF72F171AF8093321223E3A3CDB397E00D82B462BFA1F990B5D32BC3A56042F
S325000004E0C217480BF634161A3C12443C71344E0F4033AD379A223708170E7B29D011573815
S325000005001916FC31733F870186337A1A8C09400D922AB51BAD363B3AFF12DB2C1F13CE2EE6
S325000005209806992A8C1A073B6C1A850BD61608236100AB314F0FA429D537FB12791A2C30CF
S32500000540E027302350329B39AE062214BE34D818D31030388D37242C000B3C0FD424CA02A0
S325000005605D18A829FC00F907900BAA220302B401C41B6911CE3CAD1BFE20C72C2B3D0F0C53
S3250000058063296C11A42D092E040C3020820AB80C983D9708FB375D25DD254C2B8B08431409
S325000005A0E0264E3660370C3CA117B81A5A1CA527F83D9838E42528301D1246343332F42474
S325000005C0A22D5625E43D7512CF17FE099323B30C0531A42C6919651A03233020A112820B04
S325000005E0C40AA009A30F4C35E70BE72C0B02D217F7035E3A50171D20E61293101C24B20B82
S325000006005A28823FBE111C2D2C2F3124C32E142C3C1B02203207E62FB423B11ED910F60943
S32500000620400F5E3C650363217502422D2922712F9A0BF92F0B2B9F0D8A300229B410F52E93
S32500000640FC233C012611C005E632A00EBF388511C0043D2EAB17BD3F9B110E1126190018DA
S325000006606025DD2A6D308A3D6E17B723D522F70D78276906343D4027CC381A0E771B672FF0
S32500000680CA2E710E032FBF35260D792F8308EF2B7632B63D39243B184C347D21253B0F0E51
S325000006A0543095033B28F5230338B50CE90082066C2C841CC7187621243A630CDA320F2773
S325000006C09217451EB311D30ACF08453B2320F72150078D21673D102EEA0BA33E4526192E46
S325000006E079380801FD2F072DFA33E325532A391ABF0F4F1AAD33220303250B1DD0079408D6
S32500000700533C9C27B92FBF202B071427FF3D89211E270D0ED1025111C516AC0B9014520F3B
S32500000720D6218D0D602FCC38BD34540F87106D25F2348202411CD50D7F38E823B81E7B0511
S3250000074084118A348C303C3D86163F1F51369E19E210CC248A24F535450AF7303A0D451BFC
S325000007600E226A12ED055F382C13F03E162A833F5834521A3F34113E2F30EC120E37CE2A7B
S325000007800C2CDB083B33FA3D293B2739C93FE705FE0A2800D415932BBD2C2228F913180CA1
S325000007A0C01442147E09C53DB7317F0F120EA429C237EA2EE03E19219E1D3C33D31C2E303D
S325000007C0CC3A891E651BAF1CCE021E025619BB3F6B03A723DE08E41447063B1A6D2FBB07AC
S325000007E0A51C6A3CAC183D116D0FF81A601A5E0722095328351443012E36D8210B14021547