Provide fileio_any2mem()

This commit is contained in:
stefanrueger
2026-08-27 17:44:13 +02:00
parent f470b86aad
commit e1df1dba8b
2 changed files with 4 additions and 3 deletions

View File

@@ -450,7 +450,7 @@ static int ihex_readrec(struct ihexsrec *ihex, char *rec) {
}
// Extract correct memory from large any memory assuming multi-memory model
static int any2mem(const AVRPART *p, const AVRMEM *mem, const Segment *segp, const AVRMEM *any, unsigned maxsize) {
int fileio_any2mem(const AVRPART *p, const AVRMEM *mem, const Segment *segp, const AVRMEM *any, unsigned maxsize) {
// Compute location for multi-memory file input
unsigned location = maxsize > MEND(FLASH) + 1? fileio_mem_offset(p, mem): 0;
@@ -622,7 +622,7 @@ static int ihex2b(const char *infile, FILE *inf, const AVRPART *p, const AVRMEM
pmsg_warning("no end of file record found for Intel Hex file %s\n", infile);
done:
rc = any2mem(p, mem, segp, any, maxaddr);
rc = fileio_any2mem(p, mem, segp, any, maxaddr);
avr_free_mem(any);
if(!rc)
pmsg_warning("no %s data found in Intel Hex file %s\n", mem->desc, infile);
@@ -950,7 +950,7 @@ static int srec2b(const char *infile, FILE *inf, const AVRPART *p,
pmsg_warning("no end of file record found for Motorola S-Records file %s\n", infile);
done:
rc = any2mem(p, mem, segp, any, maxaddr);
rc = fileio_any2mem(p, mem, segp, any, maxaddr);
avr_free_mem(any);
if(!rc)
pmsg_warning("no %s data found in Motorola S-Record file %s\n", mem->desc, infile);

View File

@@ -1307,6 +1307,7 @@ extern "C" {
FILE *fileio_fopenr(const char *fname);
int is_generated_fname(const char *filename);
int generated_file_has_contents(const AVRPART *part, const char *filename);
int fileio_any2mem(const AVRPART *p, const AVRMEM *mem, const Segment *segp, const AVRMEM *any, unsigned maxsize);
int fileio_fmt_autodetect_fp(FILE *f);
int fileio_fmt_autodetect(const char *fname);
int fileio_mem(int oprwv, const char *filename, FILEFMT format, const AVRPART *p, const AVRMEM *mem, int size);