GUI Flash Tools fails by trying to write BSS Segments

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GUI Flash Tools fails by trying to write BSS Segments

2,447 Views
rolfw
Contributor I

Hi

there's a strange error when using the GUI Flash Too inside MCUxpresso. It looks like it tries to flash BSS segments to the RAM address which obviously fails. Below there's a log showing these errors for internal RAM BSS segments (at 0x202000E8) for IMXRT1064 as well for board SDRAM (0x80000040). I'm using the EVK board and using the managed linker script.

When I debug the program it works fine, however I saw also that it also gdb target downloads these BSS segments which takes a lot of time and is a bit strange, since they are initialized at startup. No need for target downloading them.

I've also attached the generated linker script. The BSS section in question here are from .bss_RAM3 and .bss_RAM4 in the script.

Any help is welcome!

Best

Rolf

Sending VECTRESET to run flash driver

Flash variant 'RT1064' detected (4MB = 64*64K at 0x70000000)

Closing flash driver MIMXRT1064.cfx

( 65) Chip Setup Complete

Connected: was_reset=false. was_stopped=false

( 70) License Check Complete

Loading 'imxrt_v4.axf' ELF 0x202000E8 len 0x9578

File 'imxrt_v4.axf' load failure: Ef(11). No flash configured.

Loading 'imxrt_v4.axf' ELF 0x70000000 len 0x1C760

Opening flash driver MIMXRT1064.cfx (already resident)

Sending VECTRESET to run flash driver

Flash variant 'RT1064' detected (4MB = 64*64K at 0x70000000)

Writing 116576 bytes to address 0x70000000 in Flash

1 of 1 (  0) Writing pages 0-1 at 0x70000000 with 116576 bytes

(  0) at 70000000: 0 bytes - 0/116576

( 14) at 70000000: 16384 bytes - 16384/116576

( 28) at 70004000: 16384 bytes - 32768/116576

( 42) at 70008000: 16384 bytes - 49152/116576

( 56) at 7000C000: 16384 bytes - 65536/116576

( 70) at 70010000: 16384 bytes - 81920/116576

( 84) at 70014000: 16384 bytes - 98304/116576

( 98) at 70018000: 16384 bytes - 114688/116576

(100) at 7001C000: 16384 bytes - 131072/116576

Erased/Wrote sector  0-1 with 116576 bytes in 5374msec

Closing flash driver MIMXRT1064.cfx

(100) Finished writing Flash successfully.

Flash Write Done

Loaded 0x1C760 bytes in 5659ms (about 20kB/s)

Loading 'imxrt_v4.axf' ELF 0x80000040 len 0x1930C8

File 'imxrt_v4.axf' load failure: Ef(11). No flash configured.

(100) Target Connection Failed

Unable to perform operation!

Command failed with exit code 1

Labels (1)
0 Kudos
7 Replies

2,101 Views
rolfw
Contributor I

Ok, I modified the BSS segments to (NOLOAD) and all is fine. Wonder why this isn't the default. Method used was the customization of the Freemarker templates described here:

https://community.nxp.com/message/630611 

0 Kudos

2,101 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Rolf,

I did a test with IMXRT1050-EVKB board and I couldn't regenerate your mentioned issue with SDK default demo project.

Below is Console print info:

Executing flash operation 'Program' (Program file into flash: evkbimxrt1050_elcdif_rgb.axf) - Tue Apr 23 11:18:39 CST 2019
Checking MCU info...
Scanning for targets...
Executing flash action...
MCUXpresso IDE RedlinkMulti Driver v10.3 (Feb  7 2019 22:50:02 - crt_emu_cm_redlink.exe build 760)
(  0) Reading remote configuration
Wc(03). No cache support.
Found chip XML file in C:/Workspace/MCUXpressoIDE_10.3.1_2233/evkbimxrt1050_elcdif_rgb/Debug\MIMXRT1052xxxxB.xml
(  5) Remote configuration complete
Reconnected to existing link server
Connecting to probe 1 core 0 (using server started externally) gave 'OK'
Probe Firmware: CMSIS-DAP (ARM)
Serial Number:  0227000047784e4500479004d7450030ddb1000097969900
VID:PID:  0D28:0204
USB Path: \\?\hid#vid_0d28&pid_0204&mi_03#b&263efb3e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Using memory from core 0 after searching for a good core
( 30) Emulator Connected
( 40) Debug Halt
( 50) CPU ID
debug interface type      = Cortex-M7 (DAP DP ID 0BD11477) over SWD TAP 0
processor type            = Cortex-M7 (CPU ID 00000C27) on DAP AP 0
number of h/w breakpoints = 8
number of flash patches   = 0
number of h/w watchpoints = 4
Probe(0): Connected&Reset. DpID: 0BD11477. CpuID: 00000C27. Info: <None>
Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Content of CoreSight Debug ROM(s):
RBASE E00FD000: CID B105100D PID 000008E88C ROM (type 0x1)
ROM 1 E00FE000: CID B105100D PID 04000BB4C8 ROM (type 0x1)
ROM 2 E00FF000: CID B105100D PID 04000BB4C7 ROM (type 0x1)
ROM 3 E000E000: CID B105E00D PID 04000BB00C Gen SCS (type 0x0)
ROM 3 E0001000: CID B105E00D PID 04000BB002 Gen DWT (type 0x0)
ROM 3 E0002000: CID B105E00D PID 04000BB00E Gen (type 0x0)
ROM 3 E0000000: CID B105E00D PID 04000BB001 Gen ITM (type 0x0)
ROM 2 E0041000: CID B105900D PID 04001BB975 CSt ARM ETMv4.0 type 0x13 Trace Source - Core
ROM 2 E0042000: CID B105900D PID 04004BB906 CSt type 0x14 Debug Control - Trigger, e.g. ECT
ROM 1 E0040000: CID B105900D PID 04000BB9A9 CSt type 0x11 Trace Sink - TPIU
ROM 1 E0043000: CID B105F00D PID 04001BB101 Sys (type 0x0)
NXP: MIMXRT1052xxxxB
DAP stride is 1024 bytes (256 words)
Inspected v.2 External Flash Device on SPI MIMXRT1050-EVK_S26KS512S.cfx
Image 'MIMXRT1050-EVK_S26KS512SFeb 21 2018 17:40:48'
Opening flash driver MIMXRT1050-EVK_S26KS512S.cfx
Sending VECTRESET to run flash driver
Flash variant '' detected (64MB = 256*256K at 0x60000000)
Closing flash driver MIMXRT1050-EVK_S26KS512S.cfx
( 65) Chip Setup Complete
Connected: was_reset=true. was_stopped=false
( 70) License Check Complete
Loading 'evkbimxrt1050_elcdif_rgb.axf' ELF 0x60000000 len 0x8600
Opening flash driver MIMXRT1050-EVK_S26KS512S.cfx (already resident)
Sending VECTRESET to run flash driver
Flash variant '' detected (64MB = 256*256K at 0x60000000)
Writing 34304 bytes to address 0x60000000 in Flash
1 of 1 (  0) Writing pages 0-0 at 0x60000000 with 34304 bytes
(  0) at 60000000: 0 bytes - 0/34304
( 47) at 60000000: 16384 bytes - 16384/34304
( 95) at 60004000: 16384 bytes - 32768/34304
(100) at 60008000: 16384 bytes - 49152/34304
Erased/Wrote sector  0-0 with 34304 bytes in 2323msec
Closing flash driver MIMXRT1050-EVK_S26KS512S.cfx
(100) Finished writing Flash successfully.
Flash Write Done
Loaded 0x8600 bytes in 2996ms (about 11kB/s)
Reset target (system)
Starting execution using system reset

Have a great day,
Mike

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

2,101 Views
rolfw
Contributor I

Hi

have you set up some data structures in DTC, OC and Board SDRAM which will get into respective BSS segments? Most demo projects won't use external SDRAM at all and put everything into DTC by default. The problem is related to BSS not DATA segments.

Further, it could be of course related to the 1064 flash driver as it is different from the 1050s. Although the GDB problems would be there too. You can check it if in the GDB log BSS stuff will be loaded to target which is of course not useful.

Best

Rolf

0 Kudos

2,101 Views
rolfw
Contributor I

PS: As I wrote above, the problem for me has been solved by modifying the linker scripts. As the question if BSS segments are NOLOAD or not, is a debatable one, it's fine for me. However, I am happy to assist you recreating the problem for your internal research. 

0 Kudos

2,101 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Rolf,

Thanks a lot for your help.

I try to regenerate the issue with MIMXRT1064-EVK board with SDK provided emwin_gui_demo.

From the linker file, I could find the BSS located at SDRAM, while data located at FlexSPI Flash.

pastedImage_1.png

pastedImage_2.png

Then I use [GUI Flash Tool] to program and couldn't regenerate that issue:

pastedImage_3.png

pastedImage_4.png

pastedImage_5.png

I am using the latest version MCUXpresso IDE:

MCUXpresso IDE v10.3.1 [Build 2233] [2019-02-20]

Thanks for the attention.

best regards,

Mike

0 Kudos

2,101 Views
rolfw
Contributor I

Hi

I've attached a simple test project ZIP to reproduce the problem. Basically it's the hello_world from the SDK examples for the IMXRT1064 with just 2 edits:

First, in the project properties a segment name is added in the Managed Linker Script Settings:

pastedImage_1.png

Second, in the code having uninitialized data defined:

#define DATA_LEN 16384

__attribute__((section(".BoardSdram"))) int gTestData[DATA_LEN];

and in the main just used for whatever:

int main(void)

{

    char ch;

    /* Init board hardware. */

    BOARD_ConfigMPU();

    BOARD_InitPins();

    BOARD_BootClockRUN();

    BOARD_InitDebugConsole();

    for (int i=0; i<DATA_LEN; i++)

    gTestData[i] = i;

    PRINTF("hello world.\r\n");

    while (1)

    {

        ch = GETCHAR();

        PUTCHAR(ch);

    }

}

Here's the error log from writing flash:

Image 'iMXRT10xx SFDP Aug 13 2018 11:23:59'

Opening flash driver MIMXRT1064.cfx

Sending VECTRESET to run flash driver

Flash variant 'RT1064' detected (4MB = 64*64K at 0x70000000)

Closing flash driver MIMXRT1064.cfx

( 65) Chip Setup Complete

Connected: was_reset=true. was_stopped=false

( 70) License Check Complete

Loading 'evkmimxrt1064_hello_world_bss.axf' ELF 0x70000000 len 0x5EC0

Opening flash driver MIMXRT1064.cfx (already resident)

Sending VECTRESET to run flash driver

Flash variant 'RT1064' detected (4MB = 64*64K at 0x70000000)

Writing 24256 bytes to address 0x70000000 in Flash

1 of 1 (  0) Writing pages 0-0 at 0x70000000 with 24256 bytes

(  0) at 70000000: 0 bytes - 0/24256

( 67) at 70000000: 16384 bytes - 16384/24256

(100) at 70004000: 16384 bytes - 32768/24256

Erased/Wrote sector  0-0 with 24256 bytes in 1386msec

Closing flash driver MIMXRT1064.cfx

(100) Finished writing Flash successfully.

Flash Write Done

Loaded 0x5EC0 bytes in 1668ms (about 14kB/s)

Loading 'evkmimxrt1064_hello_world_bss.axf' ELF 0x80000000 len 0x10000

File 'evkmimxrt1064_hello_world_bss.axf' load failure: Ef(11). No flash configured.

(100) Target Connection Failed

Unable to perform operation!

Command failed with exit code 1

0 Kudos

2,101 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Rolf,

Thank you for the code.

I could regenerate that issue.

For I will be out of office next whole week, I could check this issue in May.

Sorry for that.


Have a great day,
Mike

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos