No longer able to program MRAM and Flash together (can separately)

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

No longer able to program MRAM and Flash together (can separately)

Jump to solution
911 Views
CarlFST60L
Senior Contributor II

So I am currently unable to program MRAM and Flash on the current release of CW10.6 + MQX4.1.1, everything is up to date. This was originally an email to support, sorry I didn't spend a long time proof reading and editing attached is the project for you to import to your workspace and check (if needed)

 

I have uninstalled all software three times and had no luck.

 

I have a windows 7 ultimate machine x64

Cyclone Pro (ethernet / USB)

 

Here is basically what I do:

Build windows ultimate x64 from scratch

Do all updates on windows

Install CW10.6 ( I have tried the on-line and offline installations, I only install S08 and Coldfire support as we dont use the others)

Install all updates (1 by one as you update manager doesn't let you do them all in one go which is extremely unprofessional and time wasting)

Install MQX4.1.1

Install the MQX4.1.1. patch with the BSP clone tool (we usually make our own, but for this you dont need to).

Open the TWRM52259 BSP, PSP, RTCS and build the debug versions of each but with one minor change to the user_config.h below

...

#define BSP_DEFAULT_IO_CHANNEL "ttya:"  //My serial port is here on my hardware

#define BSPCFG_ENABLE_TTYA       1 //Also need to enable TTYA for it to work

...

Use the new project wizard and create a MQX4.1 project called mramtest in this case

Include the RTCS support (as we use ethernet), and dont add files, using empty application in the options

Connections, I choose normally P&E Cyclone TCP-IP and USB, and i include the Open Source BDM (we only really use the TCP but we have issues with this all the time so I make three i can play with, this part of hte tool chain is absolutely horrible and unreliable)

 

If I run this project with "hello world" in MRAM debug it works perfectly

twrmcf52259_Ext_MRAM_Debug/mramtest.elf I verified I can see address range in 0x10000000

Example of how I know 100% its running from mram you can see the address range in the disassembly window in teh debugger

10000836:   subq.l #4,a7

39                    printf("Hello World\n");

10000838:   lea 0x1000AEC9 (0x1000aec9),a0

1000083e:   move.l a0,(a7)

 

This is the consol output from when it writes to MRAM

---------------------------------------------------------------------------------------------------------------------------------------

 

Starting 3rd party flash programming...

GDI: Mtwks Callback(MTWKS_CB_PROJECTACCESS, Section : STARTUP, Entry : SPECIFY_NETWORKCARD_ENABLED, Value : 0, R) => DI_OK

INF: Copyright 2012 P&E Microcomputer Systems,Inc.

INF: Command Line :"C:\Freescale\CW MCU v10.6\eclipse\..\MCU\bin\de.exe" -noni -language en -ORBendPoint giop:tcp:127.0.0.1: -ORBtraceLevel 0

 

---------------------------------------------------------------------------------------------------------------------------------------

 

If I run this project with "hello world" in FLASH debug it works perfectly

(twrmcf52259_Int_Flash_Debug/mramtest.elf I verified I can see address range in 0x00000000)

 

Example of how I know its 100% running in flash.

The disassembly code with the debugger attached you can see

00000832:   link a6,#0

00000836:   subq.l #4,a7

39                    printf("Hello World\n");

00000838:   lea 0x0000AEC9 (0xaec9),a0

0000083e:   move.l a0,(a7)

 

And you can see it programming the FLASH:

---------------------------------------------------------------------------------------------------------------------------------------

Executing download task: C:\Users\carln.SURETEK\workspace\mramtest\mramtest_mcf52259_Int_Flash (1).tcl

cmdwin::fl::target -lc mramtest_twrmcf52259_Int_Flash_Debug_PnE Cyclone TCP-IP

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

cmdwin::fl::target -b 0x20000000 0xffff

cmdwin::fl::target -v off -l off

cmdwin::fl::device -d CFM_MCF5225X_512 -o 256Kx16x1 -a 0x0 0x7ffff

cmdwin::fl::image -f C:\Users\carln.SURETEK\workspace\mramtest\twrmcf52259_Int_Flash_Debug\mramtest.elf -t Auto Detect -re off -oe

off

cmdwin::fl::erase image

Beginning Operation ...   

-------------------------

Auto-detection is successful.  

  File is of type Elf Format.  

 

Performing target initialization ...   

Downloading Flash Device Driver ...  

Reading flash ID ...  

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

System clock check checking ...  

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

Erasing Sector 0x00000000 to 0x00000FFF  

Erasing Sector 0x00001000 to 0x00001FFF  

Erasing Sector 0x00002000 to 0x00002FFF  

Erasing Sector 0x00003000 to 0x00003FFF  

Erasing Sector 0x00004000 to 0x00004FFF  

Erasing Sector 0x00005000 to 0x00005FFF  

Erasing Sector 0x00006000 to 0x00006FFF  

Erasing Sector 0x00007000 to 0x00007FFF  

Erasing Sector 0x00008000 to 0x00008FFF  

Erasing Sector 0x00009000 to 0x00009FFF  

Erasing Sector 0x0000A000 to 0x0000AFFF  

Erasing Sector 0x0000B000 to 0x0000BFFF  

Erasing ...  

Erase Command Succeeded   

cmdwin::fl::write

Beginning Operation ...   

-------------------------

Programming file C:\Users\carln.SURETEK\workspace\mramtest\twrmcf52259_Int_Flash_Debug\mramtest.elf

Auto-detection is successful.  

  File is of type Elf Format.  

 

Downloading Flash Device Driver ...  

Reading flash ID ...  

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

System clock check checking ...  

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

Auto-detection is successful.  

  File is of type Elf Format.  

 

Downloading 0x00000418 bytes to be programmed at 0x00000000  

Executing program ....  

Program Command Succeeded   

Downloading 0x0000AC1C bytes to be programmed at 0x00000420  

Executing program ....  

Program Command Succeeded   

cmdwin::fl::verify

Beginning Operation ...   

-------------------------

Verifying file C:\Users\carln.SURETEK\workspace\mramtest\twrmcf52259_Int_Flash_Debug\mramtest.elf

Auto-detection is successful.  

  File is of type Elf Format.  

 

Auto-detection is successful.  

  File is of type Elf Format.  

 

Reading 0x00000418 bytes starting from address 0x00000000

Reading 0x0000AC1C bytes starting from address 0x00000420

Verify Command Succeeded  

cmdwin::fl::disconnect

---------------------------------------------------------------------------------------------------------------------------------------

 

 

If I modify the linker so it will put code in MRAM and FLASH it will return an error (no error listed, just an "error". It seems suddenly i am not able to write to flash and MRAM any more when I have been doing this for many years without an issue. If I import a version of software that 100% previously worked ,I get this same error, so I have narrowed it down to the most simple version for you so you dont need a copy of my actual project(s).

 

Here is how I do it so you can attempt to reproduce the fault:

 

- using the above hello world application created by the wizard

- Select the flash debug build

- create a "linker" folder in the project directory

- locate the orginal linker file and move it here so we can modify it

C:\Freescale\Freescale_MQX_4_1\lib\twrmcf52259.cw10\debug\bsp\intflash.lcf

move to

C:\Users\carln.SURETEK\workspace\mramtest\linker

- Modifiy the project settings > c/c++ build > settings > Coldfire Linker > Intput > Linker Command File (*.lcf) and change that to

"${ProjDirPath}/linker/intflash.lcf"

- Add a new source file called mram.c to the projects source folder with these three lines:

#include "main.h"

void mram_code(void);

void mram_code(void){         printf("Hello World from mram\n"); }

- in the linke rI make these change the following three things to allow me to direct code to MRAM

 

- at the top in the memory section add the location for read / write / execute for mram

mram_code_space (RWX): ORIGIN = 0x10000000, LENGTH = 0x0007FFFF

 

-Above .main_application add this bit of code that forces all the code in the c file into the mram_code_space

            .mram_Page:

            {

                        mram_c.c (.data)

                        mram_c.c (.rodata)

                        mram_c.c (.text)

            } > mram_code_space

 

-add the mram_Page to the keep_section so it doesnt get destroyed

KEEP_SECTION { .vectors_rom, .vectors_ram, .cfmconfig, mram_Page }

 

- In main.c call the code by adding

extern mram_code(void);

 

-and

mram_code();

-Build the project

 

- In the xmap file you can now see the new MRAM locations:

# .mram_Page

  10000000 00000017 .rodata @245  (mram_c.obj)

  10000018 00000018 .text   mram_code       (mram_c.obj)

 

- If I try to run the project at this point I get this error screen after it programs the flash:

22287_22287.jpgerror.jpg

 

- As you can see there is no error listed, it just says :error

- This is what the Consol show:

------------------------------------------------------------------------------------------

 

Executing download task: C:\Users\carln.SURETEK\workspace\mramtest\mramtest_mcf52259_Int_Flash (1).tcl

cmdwin::fl::target -lc mramtest_twrmcf52259_Int_Flash_Debug_PnE Cyclone TCP-IP

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

cmdwin::fl::target -b 0x20000000 0xffff

cmdwin::fl::target -v off -l off

cmdwin::fl::device -d CFM_MCF5225X_512 -o 256Kx16x1 -a 0x0 0x7ffff

cmdwin::fl::image -f C:\Users\carln.SURETEK\workspace\mramtest\twrmcf52259_Int_Flash_Debug\mramtest.elf -t Auto Detect -re off -oe

off

cmdwin::fl::erase image

Beginning Operation ...

-------------------------

Auto-detection is successful.

  File is of type Elf Format.

 

Performing target initialization ...

Downloading Flash Device Driver ...

Reading flash ID ...

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

System clock check checking ...

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

Erasing Sector 0x00000000 to 0x00000FFF

Erasing Sector 0x00001000 to 0x00001FFF

Erasing Sector 0x00002000 to 0x00002FFF

Erasing Sector 0x00003000 to 0x00003FFF

Erasing Sector 0x00004000 to 0x00004FFF

Erasing Sector 0x00005000 to 0x00005FFF

Erasing Sector 0x00006000 to 0x00006FFF

Erasing Sector 0x00007000 to 0x00007FFF

Erasing Sector 0x00008000 to 0x00008FFF

Erasing Sector 0x00009000 to 0x00009FFF

Erasing Sector 0x0000A000 to 0x0000AFFF

Erasing Sector 0x0000B000 to 0x0000BFFF

Erasing ...

Erase Command Succeeded

cmdwin::fl::write

Beginning Operation ...

-------------------------

Programming file C:\Users\carln.SURETEK\workspace\mramtest\twrmcf52259_Int_Flash_Debug\mramtest.elf

Auto-detection is successful.

  File is of type Elf Format.

 

Downloading Flash Device Driver ...

Reading flash ID ...

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

System clock check checking ...

thread break: Stopped, 0x0, 0x0, cpu68K, mramtest.elf (state, tid, pid, cpu, target)

Auto-detection is successful.

  File is of type Elf Format.

 

Downloading 0x00000418 bytes to be programmed at 0x00000000

Executing program ....

Program Command Succeeded

Downloading 0x0000AC24 bytes to be programmed at 0x00000420

------------------------------------------------------------------------------------------

 

Now I would expect that I would have to change the debugger in some way i.e.

"Debug Configurations > mramtest_twrmcf52259_Int_Flash_Debug_PnE Cyclone TCP-IP > Debugger tab > download tab > tick "Perform Standard Download".. makes no difference..

Original Attachment has been moved to: mramtest.zip

0 Kudos
1 Solution
565 Views
CarlFST60L
Senior Contributor II

I fixed it.


I fixed it!!!!!!!!!!!

1. "Perform standard Download" must be selected AND the target task must be enabled

2. You have to modify the target task so that it restricts the range to only 0x00000000 to 0x00007FFFF otherwise it tries to program / verify from the flash range which causes the unknown error.

Freescale need to fix 2 things

1. Target task default restrict range to flash range

2. fix the error message that indicates the exception out of range (or what ever) has happened so its not a blank message.

View solution in original post

0 Kudos
6 Replies
565 Views
CarlFST60L
Senior Contributor II

Ok, so I have reproduced this on a fresh windows build on a new computer.

built brand new PC on known good hardware (windows x64)

fresh installation of CW10.6 + all updates

fresh installation of MQX4.1.1 + patch (clone tool)

program hello world in twrm52259 into MRAM debug it works

program hello world in twrm52259 into flash debug it works

Using the debug build, adding some code to MRAM (so some code to flash, some to MRAM) and it crashes


This was working 100% for years, Im really desperate guys, the debugger returns a blank error and doesn't work, i cant do any development until i find a work around or a fix is released. The notes above are the exact steps i take to produce the fault.



0 Kudos
565 Views
DavidS
NXP Employee
NXP Employee

Hi Carl,

Have you tried contacting PEMicro support?  They may have advice since you are using Cyclone product from them.

http://pemicro.com/support

Regards,

David

0 Kudos
565 Views
CarlFST60L
Senior Contributor II

Hi David,

I have contacted them and directed them to this thread, hopefully someone helps me soon, this is critical.

0 Kudos
566 Views
CarlFST60L
Senior Contributor II

I fixed it.


I fixed it!!!!!!!!!!!

1. "Perform standard Download" must be selected AND the target task must be enabled

2. You have to modify the target task so that it restricts the range to only 0x00000000 to 0x00007FFFF otherwise it tries to program / verify from the flash range which causes the unknown error.

Freescale need to fix 2 things

1. Target task default restrict range to flash range

2. fix the error message that indicates the exception out of range (or what ever) has happened so its not a blank message.

0 Kudos
565 Views
soledad
NXP Employee
NXP Employee

Hello Carl,

Please check the below application note and thread

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=htt...

Best way to move RAM usage to external SRAM?


Have a great day,
Sol

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

0 Kudos
565 Views
CarlFST60L
Senior Contributor II

I have no problems with allocating memory to locations. The problem is that it is returning a blank error when the cyclone program's BOTH flash and MRAM together (which has worked fine for the last 5 years for me until i had to rebuild a fresh computer). I can 100% program MRAM and Flash independently but they will not work if i have some MRAM and some FLASH.

0 Kudos