Fix bug in usage of CONST segment in banked code. Use #pragma constseg

This commit is contained in:
logicog
2025-10-14 18:41:52 +02:00
parent 58c21a1986
commit 7546d0c685
15 changed files with 15 additions and 7 deletions
+2 -2
View File
@@ -47,7 +47,7 @@ $(BUILDDIR)%.rel: $(BUILDDIR)%.asm
${ASM} ${AFLAGS} -o $@ $< ${ASM} ${AFLAGS} -o $@ $<
# mv -f $(addprefix $(basename $^), .lst .rel .sym) . # mv -f $(addprefix $(basename $^), .lst .rel .sym) .
$(BUILDDIR)rtlplayground.ihx: $(BUILDDIR)crtstart.rel $(OBJS) $(BUILDDIR)rtlplayground.ihx: $(BUILDDIR)crtstart.rel $(OBJS)
$(CC) $(CC_FLAGS) -Wl-bHOME=${BOOTLOADER_ADDRESS} -Wl-bBANK1=0x14000 -Wl-r -o $@ $^ $(CC) $(CC_FLAGS) -Wl-bHOME=${BOOTLOADER_ADDRESS} -Wl-bBANK1=0x14000 -Wl-r -o $@ $^
$(BUILDDIR)rtlplayground.img: $(BUILDDIR)rtlplayground.ihx $(BUILDDIR)rtlplayground.img: $(BUILDDIR)rtlplayground.ihx
@@ -63,4 +63,4 @@ $(BUILDDIR)rtlplayground.bin: $(BUILDDIR)rtlplayground.img
tools/$(BUILDDIR)fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -d html -p html_data $@ tools/$(BUILDDIR)fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -d html -p html_data $@
.PHONY: clean all $(SUBDIRS) .PHONY: clean all $(SUBDIRS)
+1
View File
@@ -18,6 +18,7 @@
#include "uip/uip.h" #include "uip/uip.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
extern __xdata uint8_t minPort; extern __xdata uint8_t minPort;
extern __xdata uint8_t maxPort; extern __xdata uint8_t maxPort;
-2
View File
@@ -17,8 +17,6 @@ $(BUILDDIR)%.asm: %.c
$(CC) $(CC_FLAGS) -o $@ -c -S $< $(CC) $(CC_FLAGS) -o $@ -c -S $<
$(BUILDDIR)%.rel: $(BUILDDIR)%.asm $(BUILDDIR)%.rel: $(BUILDDIR)%.asm
./treatasm.py $^ >$^.new
mv $^.new $^
${ASM} ${AFLAGS} -o $@ $^ ${ASM} ${AFLAGS} -o $@ $^
clean: clean:
+1
View File
@@ -16,6 +16,7 @@
#define CMARK_S 6 #define CMARK_S 6
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
extern __code struct f_data f_data[]; extern __code struct f_data f_data[];
extern __code char * __code mime_strings[]; extern __code char * __code mime_strings[];
+1
View File
@@ -17,6 +17,7 @@
#include "phy.h" #include "phy.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
extern __code uint16_t bit_mask[16]; extern __code uint16_t bit_mask[16];
+1
View File
@@ -15,6 +15,7 @@
#include "phy.h" #include "phy.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
extern __code uint8_t * __code hex; extern __code uint8_t * __code hex;
extern __code uint16_t bit_mask[16]; extern __code uint16_t bit_mask[16];
+1 -1
View File
@@ -276,7 +276,7 @@ int main(int argc, char **argv)
if (arguments.prefix) if (arguments.prefix)
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "#include \"%s.h\"\n\n", arguments.prefix); ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "#include \"%s.h\"\n\n", arguments.prefix);
if (arguments.bank) if (arguments.bank)
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "#pragma codeseg %s\n\n", arguments.bank); ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "#pragma codeseg %s\n#pragma constseg %s\n\n", arguments.bank, arguments.bank);
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, " __code char * __code mime_strings[] = {\n \"text/html\",\n \"image/svg+xml\",\n" ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, " __code char * __code mime_strings[] = {\n \"text/html\",\n \"image/svg+xml\",\n"
" \"image/svg+xml\",\n \"image/png\",\n \"text/javascript\",\n \"text/css\",\n \"text/plain\"};\n\n"); " \"image/svg+xml\",\n \"image/png\",\n \"text/javascript\",\n \"text/css\",\n \"text/plain\"};\n\n");
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "__code struct f_data f_data[] = {\n"); ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "__code struct f_data f_data[] = {\n");
+1
View File
@@ -48,6 +48,7 @@
#define STATE_DATA_SENT 6 #define STATE_DATA_SENT 6
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
/* /*
* Return value of the buffering functions that indicates that a * Return value of the buffering functions that indicates that a
+1
View File
@@ -49,6 +49,7 @@
#include "timer.h" #include "timer.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
+1
View File
@@ -60,6 +60,7 @@
#include "uip-fw.h" #include "uip-fw.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
#include "../rtl837x_common.h" #include "../rtl837x_common.h"
+1 -1
View File
@@ -44,7 +44,7 @@
#include "../rtl837x_common.h" #include "../rtl837x_common.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
#define MAX_TIME 128 #define MAX_TIME 128
+1 -1
View File
@@ -41,8 +41,8 @@
#include "uip-fw.h" #include "uip-fw.h"
#include "uip_arch.h" #include "uip_arch.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
#define BUF ((__xdata struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) #define BUF ((__xdata struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
+1
View File
@@ -84,6 +84,7 @@
#include "uip_arch.h" #include "uip_arch.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
#include "uip-neighbor.h" #include "uip-neighbor.h"
+1
View File
@@ -64,6 +64,7 @@
#include "../rtl837x_common.h" #include "../rtl837x_common.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
struct arp_hdr_i { struct arp_hdr_i {
struct uip_eth_hdr ethhdr; struct uip_eth_hdr ethhdr;
+1
View File
@@ -38,6 +38,7 @@
#include "uiplib.h" #include "uiplib.h"
#pragma codeseg BANK1 #pragma codeseg BANK1
#pragma constseg BANK1
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
unsigned char unsigned char