Improve MSVC patch in stk500.c
This commit is contained in:
parent
e3efb3bce9
commit
13e404d777
20
stk500.c
20
stk500.c
|
@ -754,10 +754,16 @@ static int stk500_loadaddr(PROGRAMMER * pgm, AVRMEM * mem, unsigned int addr)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stk500_paged_write2(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
unsigned char* buf, unsigned int page_size,
|
static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||||
|
unsigned int page_size,
|
||||||
unsigned int addr, unsigned int n_bytes)
|
unsigned int addr, unsigned int n_bytes)
|
||||||
{
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
unsigned char* buf = _alloca(page_size + 16);
|
||||||
|
#else
|
||||||
|
unsigned char buf[page_size + 16];
|
||||||
|
#endif
|
||||||
int memtype;
|
int memtype;
|
||||||
int a_div;
|
int a_div;
|
||||||
int block_size;
|
int block_size;
|
||||||
|
@ -848,16 +854,6 @@ static int stk500_paged_write2(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||||
return n_bytes;
|
return n_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
unsigned int page_size,
|
|
||||||
unsigned int addr, unsigned int n_bytes)
|
|
||||||
{
|
|
||||||
unsigned char* buf = malloc(page_size + 16);
|
|
||||||
int result = stk500_paged_write2(pgm, p, m, buf, page_size, addr, n_bytes);
|
|
||||||
free(buf);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||||
unsigned int page_size,
|
unsigned int page_size,
|
||||||
unsigned int addr, unsigned int n_bytes)
|
unsigned int addr, unsigned int n_bytes)
|
||||||
|
|
Loading…
Reference in New Issue