Use of SRAM beyond 64K for K60 controller with MQX RTOS-RTCS using CodeWarrior

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Use of SRAM beyond 64K for K60 controller with MQX RTOS-RTCS using CodeWarrior

跳至解决方案
1,212 次查看
dineshsonagra
Contributor III

Hi Friends,

We are developing an application using K60 micro controller (128KB internal SRAM) with use of MQX RTOS and RTCS. CodeWarrior's Basic suit with MQX 4.1.0 is used for software development.

Till date, SRAM memory requirement of our system was less than 64KB and every things are working OK.

But during our application expansion phase, we need more SRAM (total RAM around 85KB) to accommodate additional variables. On project compilation, there is no error and seen that memory map is OK. But when we run this application, program hangs out.

Is this because of RAM requirement for MQX RTOS-RTCS components ? If yes, then is there any way out to get more memory ?

How to know that what amount of memory is taken away by MQX components ?

Is there any option to be defined in the code warrior environment to set MQX memory in the upper RAM area ?

regds,

Dinesh

0 项奖励
回复
1 解答
943 次查看
Carlos_Musich
NXP Employee
NXP Employee

Hi Dinesh,

as Norm said, if an object (variable, array, struct or even a function) is placed in 64K boundaries it may overlap both RAM segments. This is a problem because RAM segments are accessed by different buses, so if an object share both segments access will fail causing a crash.

Besides this you must verify that the Kernel space (mainly the heap) is not overlapping both segments. Please take a look to the thread below where isaacavila​ explains this case.

RAM Memory Utilization

Regards,

Carlos

在原帖中查看解决方案

0 项奖励
回复
5 回复数
943 次查看
ndavies
Contributor V

On the 128 K parts you must make sure variables aren't straddling the 64K boundary. The parts have 2 SRAM blocks. Atomic reads and writes cannot span the 64k boundary between the 2 blocks.

On our products, the division between SRAM blocks fell within our heap. We allocated and orphaned a memory allocation on the dividing line.

0 项奖励
回复
943 次查看
dineshsonagra
Contributor III

Hi Norm Davies, Yes, you are right. Hence we have tried to work with RAM segment as below.MEMORY

{

vectorrom  (RX): ORIGIN = 0x00000000, LENGTH = 0x00000400

cfmprotrom  (R): ORIGIN = 0x00000400, LENGTH = 0x00000020

rom        (RX): ORIGIN = 0x00000420, LENGTH = 0x0007FBE0  /* Code + Const data /  my_ram        (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00010000  / SRAM - RW data / ram (RW): ORIGIN = 0x20000000, LENGTH = 0x0000FA00  / SRAM - RW data */

/* kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap) */

end_of_kd  (RW): ORIGIN = 0x2000FFF0, LENGTH = 0x00000000

/* Boot stack reused by MQX Kernel data */

bstack      (RW): ORIGIN = 0x2000FA00, LENGTH = 0x00000200  /* Boot stack */

end_bstack  (RW): ORIGIN = 0x2000FC00, LENGTH = 0x00000000  /* Boot stack end address requires 4B alignment */

}SECTIONS{    __INTERNAL_SRAM_BASE  = 0x20000000;    __INTERNAL_SRAM_SIZE  =  0x0000FA00; .... }.my_section    {        __my_section_start = .; . = ALIGN (0x4);;;;;;;;;;;; additional variables are defined here...    } > my_ram       But this has also not resolve the problem.Is there any error in above procedure ?It will be nice if you can give us the sample method to define memory blocks in RAM segments.Do you recommend to use MQX 4.2.0 as against MQX 4.1.0 ? Some one has advise to use MQX 4.2.0 along with patch MQX 4.2.0.1.regds,Dinesh

From: ndavies <admin@community.freescale.com>

To: Dinesh Sonagra <rnd.himson@yahoo.co.in>

Sent: Saturday, 13 February 2016 12:11 AM

Subject: Re: - Use of SRAM beyond 64K for K60 controller with MQX RTOS-RTCS using CodeWarrior

#yiv5766559927 * #yiv5766559927 a #yiv5766559927 body {font-family:Helvetica, Arial, sans-serif;}#yiv5766559927 #yiv5766559927 h1, #yiv5766559927 h2, #yiv5766559927 h3, #yiv5766559927 h4, #yiv5766559927 h5, #yiv5766559927 h6, #yiv5766559927 p, #yiv5766559927 hr {}#yiv5766559927 .yiv5766559927button td {}

|

NXP Community

|

Use of SRAM beyond 64K for K60 controller with MQX RTOS-RTCS using CodeWarrior

reply from Norm Davies in Kinetis Microcontrollers - View the full discussionOn the 128 K parts you must make sure variables aren't straddling the 64K boundary. The parts have 2 SRAM blocks. Atomic reads and writes cannot span the 64k boundary between the 2 blocks. On our products, the division between SRAM blocks fell within our heap. We allocated and orphaned a memory allocation on the dividing line.

Reply to this message by replying to this email, or go to the message on NXP Community

Start a new discussion in Kinetis Microcontrollers by email or at NXP Community

Following Use of SRAM beyond 64K for K60 controller with MQX RTOS-RTCS using CodeWarrior in these streams: Inbox

This email was sent by NXP Community because you are a registered user.

You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences |

|

0 项奖励
回复
944 次查看
Carlos_Musich
NXP Employee
NXP Employee

Hi Dinesh,

as Norm said, if an object (variable, array, struct or even a function) is placed in 64K boundaries it may overlap both RAM segments. This is a problem because RAM segments are accessed by different buses, so if an object share both segments access will fail causing a crash.

Besides this you must verify that the Kernel space (mainly the heap) is not overlapping both segments. Please take a look to the thread below where isaacavila​ explains this case.

RAM Memory Utilization

Regards,

Carlos

0 项奖励
回复
943 次查看
dineshsonagra
Contributor III

Dear Carlos,

Thanks...

From: Carlos_Musich <admin@community.freescale.com>

To: Dinesh Sonagra <rnd.himson@yahoo.co.in>

Sent: Monday, 15 February 2016 10:52 PM

Subject: Re: - Use of SRAM beyond 64K for K60 controller with MQX RTOS-RTCS using CodeWarrior

#yiv0540147992 * #yiv0540147992 a #yiv0540147992 body {font-family:Helvetica, Arial, sans-serif;}#yiv0540147992 #yiv0540147992 h1, #yiv0540147992 h2, #yiv0540147992 h3, #yiv0540147992 h4, #yiv0540147992 h5, #yiv0540147992 h6, #yiv0540147992 p, #yiv0540147992 hr {}#yiv0540147992 .yiv0540147992button td {}

|

NXP Community

|

Use of SRAM beyond 64K for K60 controller with MQX RTOS-RTCS using CodeWarrior

reply from Carlos_Musich in MQX Software Solutions - View the full discussionHi Dinesh, as Norm said, if an object (variable, array, struct or even a function) is placed in 64K boundaries it may overlap both RAM segments. This is a problem because RAM segments are accessed by different buses, so if an object share both segments access will fail causing a crash. Besides this you must verify that the Kernel space (mainly the heap) is not overlapping both segments. Please take a look to the thread below where isaacavila explains this case.  RAM Memory Utilization  Regards,Carlos

Reply to this message by replying to this email, or go to the message on NXP Community

Start a new discussion in MQX Software Solutions by email or at NXP Community

Following Use of SRAM beyond 64K for K60 controller with MQX RTOS-RTCS using CodeWarrior in these streams: Inbox

This email was sent by NXP Community because you are a registered user.

You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences |

|

0 项奖励
回复
943 次查看
dineshsonagra
Contributor III

Hi Norm Davies,

Yes, you are right. Hence we have tried to work with RAM segment as below.

MEMORY
{
vectorrom  (RX): ORIGIN = 0x00000000, LENGTH = 0x00000400
cfmprotrom  (R): ORIGIN = 0x00000400, LENGTH = 0x00000020
rom        (RX): ORIGIN = 0x00000420, LENGTH = 0x0007FBE0  /* Code + Const data */

  my_ram        (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00010000  /* SRAM - RW data */

ram (RW): ORIGIN = 0x20000000, LENGTH = 0x0000FA00  /* SRAM - RW data */

/* kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap) */
end_of_kd  (RW): ORIGIN = 0x2000FFF0, LENGTH = 0x00000000

/* Boot stack reused by MQX Kernel data */
bstack      (RW): ORIGIN = 0x2000FA00, LENGTH = 0x00000200  /* Boot stack */
end_bstack  (RW): ORIGIN = 0x2000FC00, LENGTH = 0x00000000  /* Boot stack end address requires 4B alignment */
}

SECTIONS

{

    __INTERNAL_SRAM_BASE  = 0x20000000;

    __INTERNAL_SRAM_SIZE  =  0x0000FA00;

....

}

.my_section

    {

        __my_section_start = .;

. = ALIGN (0x4);

;;;;;;;;;;; additional variables are defined here...

    } > my_ram      

But this has also not resolve the problem.

Is there any error in above procedure ?

It will be nice if you can give us the sample method to define memory blocks in RAM segments.

Do you recommend to use MQX 4.2.0 as against MQX 4.1.0 ? Some one has advise to use MQX 4.2.0 along with patch MQX 4.2.0.1.

regds,

Dinesh

0 项奖励
回复