Hi,
I am trying to make a basic webserver, and since I have a Atmega128 with plenty of free flash, I will use that to store the webfiles.
In order to change the webfiles without having to redo the arrays myself, I would like to use the linking with object files.
...But somewhere along the way I did it wrong
I make an .o file
avr-objcopy --rename-section .data=.progmem.data,contents,alloc,load,readonly,data -I binary -O elf32-avr ../index.html index_html.o
I add this in Libraries in AVR studio, save and project save.
In a .h file I have
extern const char index_html[] PROGMEM; extern const char index_html_end[] PROGMEM; extern const char index_html_size_sym[]; #define index_html_size index_html_size_sym
My test code to read the string
printf("Try to readout index_html_o\r\n"); uint16_t address = _binary_index_html_bin_start_ ; //Also tried uint16_t address = index_html; while (address < index_html_end) { uint8_t result = pgm_read_byte(address); printf("/c",result); //Change to a percent sign address++; _delay_ms(100); }
And compiler output
../enc28j60_test.c: In function 'main':
../enc28j60_test.c:244: error: '_binary_index_html_bin_start_' undeclared (first use in this function)
../enc28j60_test.c:244: error: (Each undeclared identifier is reported only once
../enc28j60_test.c:244: error: for each function it appears in.)
../enc28j60_test.c:246: warning: comparison between pointer and integer
Any help will be much appreciated!