Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Ariadne TCP/IP bootloader

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR
View previous topic :: View next topic  
Author Message
delude

Bascom Member



Joined: 27 Oct 2018
Posts: 2

PostPosted: Wed Dec 06, 2023 3:43 pm    Post subject: Ariadne TCP/IP bootloader Reply with quote

Hi,
I needed a bootloader for my project that would work over TCP/IP. I found the Ariadne Bootloader, designed for Arduino projects. When I tried to upload a *.bin file created by Bascom, the file was rejected due to some "validation." I disabled this protection in the source files and recompiled it. If it helps someone, the finished files for Atmega1284, Atmega328, and Atmega2560 are included in the zip file.

I also attached a write_ariadne_eeprom.bas file for writing TCP/IP configuration to EEPROM.
I hope it will be useful.


I'm also curious about what the "validation" of the *.bin file is. And why the Bascom bin file is different from the Arduino *.bin file. Smile

Vojta

(BASCOM-AVR version : 2.0.8.6 )
Back to top
View user's profile
Netzman

Bascom Expert



Joined: 25 Nov 2005
Posts: 127
Location: Graz

austria.gif
PostPosted: Fri Dec 08, 2023 7:00 pm    Post subject: Reply with quote

The validation (https://github.com/per1234/Ariadne-Bootloader/blob/ariadne/bootloaders/ariadne/validate.c) checks if the complete IVT (interrupt vector table) consists of JMP xxxx instructions, which is the case for an avr-gcc compiled program like in this example:
https://www.avrfreaks.net/s/topic/a5C3l000000UZpiEAG/t151536?comment=P-1365028
Every unused interrupt vector is a jump to an error handling sub routine, which in this case consists of a JMP 0 (resets program execution).

Bascom on the other side has a different approach and outputs a RETI and NOP for every unused vector:
Code:
       0:       0C 94 FA 00     JMP     0x1F4           ;  0x1F4
       4:       18 95           RETI
       6:       00 00           NOP
       8:       18 95           RETI
       A:       00 00           NOP
       C:       18 95           RETI
       E:       00 00           NOP
      10:       18 95           RETI
      12:       00 00           NOP
      14:       18 95           RETI
      16:       00 00           NOP
      18:       18 95           RETI
      1A:       00 00           NOP
      1C:       18 95           RETI
      1E:       00 00           NOP
      20:       18 95           RETI
      22:       00 00           NOP
      24:       18 95           RETI
      26:       00 00           NOP
      28:       18 95           RETI
      2A:       00 00           NOP
      2C:       18 95           RETI
      2E:       00 00           NOP
      30:       18 95           RETI
      32:       00 00           NOP
      34:       18 95           RETI
      36:       00 00           NOP
      38:       0C 94 5F 02     JMP     0x4BE           ;  0x4BE
      3C:       18 95           RETI
      3E:       00 00           NOP
      ...


So that is why the validation is failing.

It should be possible to convince the unmodified bootloader to accept a Bascom binary by declaring every available, unused interrupt like this:
Code:
On Int0 0

This creates the corresponding entry in the IVT with a JMP to address 0.

br

_________________
LCD Menu | Proportional Fonts
Back to top
View user's profile Visit poster's website
delude

Bascom Member



Joined: 27 Oct 2018
Posts: 2

PostPosted: Sun Dec 10, 2023 9:42 pm    Post subject: Reply with quote

Thank you a lot for your answer and for making this
clear for me Smile


V.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum