Varying exceptions problem

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I’m using evk1100 rev C, AVR studio 2.1, mkII environment to develop code which uses freertos and lwIP etc. I have configured the external SDRAM as a heap by using avr32elf_uc3a0512.x linker script (attached), which I have modified only by changing heap start and end addresses. Also, I have added sdram initialization in _init_startup function. SDRAM works fine. Otherwise I’m using pretty much the set up provided by software framework example.

Now, I have worked on integrating a module (zlib) in my application. First, I compiled it in separate simple project without freertos, with sdram as a heap. It works fine.

When I take the same module codes in my freertos based application and try to test it in a similar way in a simple task, it ends up with a Data Address Read exception while excecuting zlib code. The assembly code that causes the exception is

0x800029b4 : ld.uh r8,r8[0x2]

The r8 contains address of flash or sdram (0x8001da77, 0xd673da77), which varies because of unknown reason, and the code tries to read a value from a static const vector. This happens without optimization. When I modify the particular code line so that it uses more local variables, the compiled machine code changes and it works, which is, of course, not the solution. Anyway, the code itself is not the reason. That is, when I set -O1 on, a Bus Error Data Fetch exception occurs - not in the same code line but later.

I have seen couple of post with similar kind of issue, but they give no solution:
https://www.avrfreaks.net/index.p...

Thank you

Attched:
Linker script.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What's your clock speed? Above 33Mhz you need to set the flash to 1 wait state.

Letting the smoke out since 1978

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

This issue was solved. My linker script was incorrect regarding SDRAM and heap definitions. For instance, it was missing sdram definition under MEMORY command. Thus, the address of SDRAM was wrong when I was debugging. Very difficult to track, because I had used and debugged sdram without any problems before this, by doing the actions described in the original post. A working script was provided by Atmel and a similar kind of script is actually included in SSLExample project included in software framework.

Clock speed was 12MHz, so that was not the case.