EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Segger file system and SDRAM

Started by bikerdan January 25, 2011
I am working with an LPC2478 and the Segger file system and an IAR IDE. I
am having trouble getting the file system to work out of SDRAM. It works
fine from on chip RAM. The SDRAM even passes a memory check. But when I try
to open a file with the Segger file system using SDRAM, at one point in the
execution a function that is accessed by pointer goes bad.

Any thoughts greatly appreciated.

	   
					
---------------------------------------		
Posted through http://www.EmbeddedRelated.com
Op Tue, 25 Jan 2011 13:43:48 +0100 schreef bikerdan  
<dan.thompson@n_o_s_p_a_m.nordson.com>:
> I am working with an LPC2478 and the Segger file system and an IAR IDE. I > am having trouble getting the file system to work out of SDRAM. It works > fine from on chip RAM. The SDRAM even passes a memory check. But when I > try to open a file with the Segger file system using SDRAM, at one point > in the execution a function that is accessed by pointer goes bad. > > Any thoughts greatly appreciated.
What makes you think that we are more suited to solve this problem than the Technical Support department of your Segger distributor and/or Segger itself? -- Gemaakt met Opera's revolutionaire e-mailprogramma: http://www.opera.com/mail/
>Op Tue, 25 Jan 2011 13:43:48 +0100 schreef bikerdan ><dan.thompson@n_o_s_p_a_m.nordson.com>: >> I am working with an LPC2478 and the Segger file system and an IAR IDE.
I
>> am having trouble getting the file system to work out of SDRAM. It
works
>> fine from on chip RAM. The SDRAM even passes a memory check. But when I
>> try to open a file with the Segger file system using SDRAM, at one point
>> in the execution a function that is accessed by pointer goes bad. >> >> Any thoughts greatly appreciated. > >What makes you think that we are more suited to solve this problem than >the Technical Support department of your Segger distributor and/or Segger
>itself? > > > >-- >Gemaakt met Opera's revolutionaire e-mailprogramma: >http://www.opera.com/mail/ >
Excellent question. I think that because they were unable to solve the problem after two weeks of troubleshooting. I was finally able to solve the problem myself. It turned out that there were some functions in the Segger source code that were called by pointer. Those pointers were in initialized RAM. If you didn't know that (and I didn't) then when you set the linker to put variables in external SDRAM the initialized pointers got whacked. A single line in the linker file putting all initialized RAM in the internal chip RAM fixed the problem. It's surprising to me that Segger tech support had not run across that already but they never suggested to me that it could be a linker problem. --------------------------------------- Posted through http://www.EmbeddedRelated.com
On 26/01/2011 15:22, bikerdan wrote:
>> Op Tue, 25 Jan 2011 13:43:48 +0100 schreef bikerdan >> <dan.thompson@n_o_s_p_a_m.nordson.com>: >>> I am working with an LPC2478 and the Segger file system and an IAR IDE. > I >>> am having trouble getting the file system to work out of SDRAM. It > works >>> fine from on chip RAM. The SDRAM even passes a memory check. But when I > >>> try to open a file with the Segger file system using SDRAM, at one point > >>> in the execution a function that is accessed by pointer goes bad. >>> >>> Any thoughts greatly appreciated. >> >> What makes you think that we are more suited to solve this problem than >> the Technical Support department of your Segger distributor and/or Segger > >> itself? >> >> >> >> -- >> Gemaakt met Opera's revolutionaire e-mailprogramma: >> http://www.opera.com/mail/ >> > > Excellent question. I think that because they were unable to solve the > problem after two weeks of troubleshooting. I was finally able to solve the > problem myself. It turned out that there were some functions in the Segger > source code that were called by pointer. Those pointers were in initialized > RAM. If you didn't know that (and I didn't) then when you set the linker to > put variables in external SDRAM the initialized pointers got whacked. A > single line in the linker file putting all initialized RAM in the internal > chip RAM fixed the problem. It's surprising to me that Segger tech support > had not run across that already but they never suggested to me that it > could be a linker problem. >
I don't think it is surprising that the tech support people hadn't come across the problem. If they deliver C code, then it will be tested to work in a normal C environment. That means it assumes that the data section is initialised on startup, and the bss section is clearer. If you mess about with linker arrangements to put the data and/or bss sections somewhere your tools don't expect, then it is up to you to ensure that these are initialised properly. If you have moved the bss section (or part of it) to external ram, make sure that you are correctly zeroing it at startup - otherwise you might find some unpredictable problems later on.

Memfault Beyond the Launch