region CODE_RAM is full

I’ve asked in several existing threads about this, but it looks like it needs its own threads.

I’m migrating an app that began life on the command line in 6.0b and has been upgraded up to 7.3. I am trying to move it to ESP on 7.4.2. The way it was built before doesn’t lend itself very well to ESP, so I am taking the following approach.

I start a new project with the wizard, selecting Net+OS project. This builds a shell application, which I can compile and load into my module. It doesn’t do anything, but it builds and I can get to its web pages, etc. I selected only the modules I need, web server, SNTP, FTP server and SSL. I also set the BSP parameters to enable the C Library filesystem, and turn off Auto IP and the dialog. Then I begin adding code from my old app one section at a time. After adding only a couple of small functions (initialize the I/O pins, open the serial port, read config data from the filesystem), when I build, I get an error saying that CODE_RAM is full. Here’s the link stage of the build:

Building target: image.elf
arm-elf-gcc -o image.elf ./web/RpPages.o ./web/RpUsrDct.o ./web/filelist_v.o ./web/index_v.o ./web/network_config_v.o ./web/reboot_status_v.o ./web/reboot_v.o ./web/session.o ./web/upload_firmware_v.o ./web/webmenu.o ./web/webutil.o ./web/wireless_ip_config_v.o ./web/wireless_network_config_v.o ./web/scripts/errhandler.o ./web/scripts/utils.o ./web/scripts/validation.o ./web/img/logo.o ./web/html/filelist.o ./web/html/index.o ./web/html/network_config.o ./web/html/reboot.o ./web/html/reboot_status.o ./web/html/upload_firmware.o ./web/html/wireless_ip_config.o ./web/html/wireless_network_config.o ./web/css/stylesheet.o ./Com_Main.o ./GP_IO.o ./appconf_api.o ./config.o ./dgSyslog.o ./errors.o ./root.o ./tcpip_wrap.o ./sys/util/cpu_utilization.o ./sys/util/firmware.o ./sys/util/nsuptime.o ./sys/http/cgi.o ./sys/http/file.o ./sys/http/httpsvr.o ./sys/http/security.o ./sys/ftp/ftpsvr.o ./sys/filesys/fileinit.o ./sys/cli/clisvr.o ./sys/cli/cliwireless.o ./sys/appservices.o -mbig-endian -nostartfiles -mcpu=arm7tdmi -T bsp/7_4/connectme/ls/image.ld bsp/7_4/connectme/lib/reset.o /cygdrive/C/netos74/lib/arm7/32b/gnu/memcpy.o /cygdrive/C/netos74/lib/32b/gnu/crt0.o -Wl,–start-group bsp/7_4/connectme/lib/libbsp.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libflashdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libsntpdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libposixdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libdnsclntdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libtcpip_no_ipsecdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libtxdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libaddpdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libtelnsvrdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libfilesysdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libftpsvrdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/librphttpddbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libsshdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libssldbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libcryptodbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libemailcdbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/libmanapidbg.a /cygdrive/C/netos74/lib/arm7/32b/gnu/librealportdbg.a -L /cygdrive/C/netos74/lib/32b/gnu -lc -lgcc -lm -lstdc++ -Wl,–end-group -Wl,-Map,
/usr/lib/gcc/arm-elf/4.2.0/…/…/…/…/arm-elf/bin/ld: region CODE_RAM is full (image.elf section .shadowRom)
collect2: ld returned 1 exit status
make: *** [image.elf] Error 1
make: Target `all’ not remade because of errors.
Build complete for project Exchange ConnectME

First of all, what little code I’ve added shouldn’t be enough to put such an app over the limit.

Second, no matter how I try, I can’t get rid of it trying to link in librealport and libemail, neither of which I need or were in my old makefile based app.

Any ideas of what could be wrong?

If it matters, I’m running on Windows 7 64 bit, and my ESP About box shows Version: 1.4.0, Build id: 03132009 NET+OS 7.4.2.



The following may help:

In your project workspace, go to directory \bsp\7_4.

Look for file customize.ldr. Open file customize.ldr, with your text editor,.

Search for MAX_CODE_SIZE. For the Digi connectme module, the default MAX_CODE_SIZE value is 2 MB.

It is very possible that your application (uncompressed) has exceeded this size (2MB).

Using your text editor, increase this value (MAX_CODE_SIZE). You’ll be the best judge of the size you’ll need. You might want to start small, by increasing MAX_CODE_SIZE from 2M to 3M.

Save the changes you made to customize.ldr and rebuild your application. If this does not correct the build error, you may need to increase MAX_CODE_SIZE further.

After updating customize.ldr, ensure that your bsp (and your project) is(are) rebuilt

In other threads, I’ve seen that mentioned, but there is also mention of needing to adjust bootldr.dat and/or blbootldr.dat, but no real description of what needs changing.

To the best of my knowledge, the CODE_RAM full is applicable to the image only, thus I do not believe bootloader.dat et al are applicable. You should try the recommendations I made previously and let us know of the results.

Changing the app size to 3M allows the app to build, but it doesn’t run properly on my JTAG module, locking up in the middle of a fairly innocuous routine. I don’t know if that is related or not.

The other threads said something about the application image expanding over the bootloader if you don’t adjust the other files, but didn’t say which parameters to adjust to prevent that. It supposedly wouldn’t effect running in the debugger, only when you FTP in your image.

The lockup wasn’t related, it was using a pointer parameter name the same as a global variable which was of the same time… it compiled, but really fouled memory.