Look up tables / RAM ?

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

Hello All,

I've only been using Atmel stuff for a couple of weeks, so I'm still not up to speed on them (been a PIC man, man and boy !).

I'm using AVR studio + AVR GCC + STK500 ISP to develop some code for an ATtiny24V, which is just about complete, so far so good :)

When I include a LUT (Look up table):

static const char Data_Table[ ] =
{
0, 94, 188, 226, 97, 63, 221, 131, 194, 156, 126, 32, 163, 253, 31, 65.... etc
};

OR I include :

#define HEADER "TEST_HEADER"

It also seems to copy the data into RAM space (I can see it when I look via AVR Studio), and it leaves no room for the stack + the one or two variables I'm actually using (see below). I don't get why it says that Data=220% (and it does crash) but warnings=0.

OK, the compiler might want to use the RAM to improve the running speed, but how do I turn it off ? I've tried all the -0x options I can see. Any idea ? Suggestions ?

Thanks

Dren

****

Build started 31.10.2008 at 13:22:47
avr-gcc.exe -mmcu=attiny24 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT main.o -MF dep/main.o.d -c ../main.c
avr-gcc.exe -mmcu=attiny24 -Wl,-Map=WPTT.map main.o -o WPTT.elf
avr-objcopy -O ihex -R .eeprom WPTT.elf WPTT.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex WPTT.elf WPTT.eep || exit 0
avr-objdump -h -S WPTT.elf > WPTT.lss

AVR Memory Usage
----------------
Device: attiny24

Program: 1448 bytes (70.7% Full)
(.text + .data + .bootloader)

Data: 282 bytes (220.3% Full)
(.data + .bss + .noinit)

Build succeeded with 0 Warnings...

<º))))><

I am only one lab accident away from becoming a super villain.

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

Have a look at PROGMEM, eg. read this tutorial: https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=38003 Should answer a few questions...

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

Hey, that's excellent - it explains it.

I've done the work around and it works :)

Hmm... everything working perfectly on a friday afternoon... time to slowly back away from the bench holding eye contact at all times and go home asap.

Thanks for all your help have a great weekend ;)

<º))))><

I am only one lab accident away from becoming a super villain.