avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] linker issue, resolving a pointer as uint32_t


From: Torsten Mohr
Subject: [avr-gcc-list] linker issue, resolving a pointer as uint32_t
Date: Sun, 26 Jun 2005 18:34:08 +0200
User-agent: KMail/1.8

Hi,

i'd like to put some structure into an application that the bootloader
can use to check if the application is valid or not.

For this i define a structure APP_INFO:
typedef struct {
  uint32_t magic;
  uint32_t version;
  uint32_t begin;  // a pointer
  uint32_t end;  // apointer
  uint16_t crc;
  unsigned char username[8];
  unsigned char linktime[32];
} APP_INFO;


In the application i fill in the values like this:

const uint32_t app_info_end __attribute__ ((section(".fini0"))) =
APP_INFO_END;

const APP_INFO app_info __attribute__ ((section(".vectors"))) = {
  APP_INFO_MAGIC,
  1,
  &app_info + sizeof(APP_INFO),
  &app_info_end,
  0xadde,
  "a_____b",
  "c_____________________________d"
};

This results in an error at link time, the members .begin and .end
can't be resolved at load time.

But when i change their type to "void*", it all works fine.


When the application becomes larger, the member .end may become
larger than 16 bits, so i'd like to store at least this value with 32 bits.
Actually, i'd still like to store both values as 32 bits, as they should
become arguments to pgm_read_byte_far.

I don't understand why the values can't be stored as uint32_t, can
somebody please explain this to me?  To my understanding the
linker should be able to resolve this.


Is there a way to store the values as 32 bits?

The size of a pointer (sizeof) seems to be two bytes.  This is not enough
to describe a memory location properly anyway.  Is there another type
that i can use to describe a memory location in flash in 128k ?


Best regards,
Torsten.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]