about e2448:I've really checked all the manuals and think I've done right ,but...

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

about e2448:I've really checked all the manuals and think I've done right ,but...

Jump to solution
805 Views
fugrace
Contributor III

Hi,everyone.

I'm really puzzled about the problem.I really think I've done right but still it can't work under flash mode.So I beg you check other possible reason for me,like the IDE.

I'm using CW10.3,k10,and I've modified my code like this:

#pragma define_section relocate_code ".data2" ".data2" ".data2" far_abs RX

#pragma section relocate_code begin

void set_sys_dividers(uint32 outdiv1, uint32 outdiv2, uint32 outdiv3, uint32 outdiv4)

{

    uint32 temp_reg;

    uint8 i;

    temp_reg = FMC_PFAPR;

    ......

}

#pragma section relocate_code end

 

I didn't modify the default linker command file.There's 3 warnings saying  that:" ignoring #pragma define_section" before every "#pragma".then I check the map file to find that the function of set_sys_dividers() still locates in  the .text. Then the program can't execute.

The linker file is attached to approve that the section of .data2 was used right.Besides I didn't add a function of copy_to_ram to the source file since there's a default function in the romcopy.c.I think there's no problem of it.

Original Attachment has been moved to: MK10DX128_flash.ld.zip

Labels (1)
0 Kudos
1 Solution
646 Views
chris_brown
NXP Employee
NXP Employee

Hi fu grace,

It looks like you might be mixing Legacy CodeWarrior operation with the new GCC functionality.  CodeWarrior 10.3 introduced a GCC compiler.  So you now have the option to use the legacy CodeWarrior compiler or the GCC compiler within the IDE.  Can you check that you are using the GCC compiler in CodeWarrior?  If you need help with that just let me know.

So with that, it looks like you are using the legacy CodeWarrior commands to place your function in RAM.  These commands are not supported by GCC.  You will want to use the GCC commands to accomplish your goal.

We do have an application note with this information in it.  AN4695 targets users who wish to perform in-software flash programming algorithms, but there is information that will be applicable.  Specifically you will want to check out chapter 6.2 and 6.3.  This application note can be found here:

http://cache.freescale.com/files/32bit/doc/app_note/AN4695.pdf?fsrch=1&sr=23

Hope this helps.

Chris

View solution in original post

0 Kudos
4 Replies
647 Views
chris_brown
NXP Employee
NXP Employee

Hi fu grace,

It looks like you might be mixing Legacy CodeWarrior operation with the new GCC functionality.  CodeWarrior 10.3 introduced a GCC compiler.  So you now have the option to use the legacy CodeWarrior compiler or the GCC compiler within the IDE.  Can you check that you are using the GCC compiler in CodeWarrior?  If you need help with that just let me know.

So with that, it looks like you are using the legacy CodeWarrior commands to place your function in RAM.  These commands are not supported by GCC.  You will want to use the GCC commands to accomplish your goal.

We do have an application note with this information in it.  AN4695 targets users who wish to perform in-software flash programming algorithms, but there is information that will be applicable.  Specifically you will want to check out chapter 6.2 and 6.3.  This application note can be found here:

http://cache.freescale.com/files/32bit/doc/app_note/AN4695.pdf?fsrch=1&sr=23

Hope this helps.

Chris

0 Kudos
646 Views
fugrace
Contributor III

Hi Chris.

That really helps.After changed the #pragma to #define __relocate_code__ __attribute__((section(".data2"), long_call)) .then I do can find my function locateing in the .data2 in the map file.

But,but..the program still can't execute well,it jumps to the default handler().I don't know what's wrong .

And would you be nice to tell me how to change the compiler to Freescale compiler,I only see the GCC compiler in the tool settings.

Thank you very much.

Grace

0 Kudos
646 Views
chris_brown
NXP Employee
NXP Employee

Hi Grace,

So typically when the program just jumps to the default handler, it is because you have accessed something you aren't supposed to.  Like you accessed a peripheral module when the clock to that module was gated off in the SIM, or you tried to write to a Flash location (as if it were a regular variable in RAM), or something of the sort.  So I would start with those two scenarios.

As for changing the compiler, I don't know right off how to do that in your current project.  I feel the easiest way to go about that is to start a new project and make sure you select the legacy FSL compiler in the New Project Wizard (when you come to that option).

Thanks!

Chris

0 Kudos
646 Views
fugrace
Contributor III

Hi Chris,

Thank you very much.I will check it by myself.

Grace

0 Kudos