ulp_main.elf text not fit in ram (Solved)

vinimac
Posts: 24
Joined: Sun May 06, 2018 1:04 pm

ulp_main.elf text not fit in ram (Solved)

Postby vinimac » Mon Aug 06, 2018 8:44 pm

Hi all,

I getting this error:

CPP main/ulp/readIO.S
ULP_AS build/main/readIO.ulp.o
ULP_LD build/main/ulp_main.elf
esp32ulp-elf-ld: ulp_main.elf section `.text' will not fit in region `ram'
esp32ulp-elf-ld: region `ram' overflowed by 72 bytes
/home/vini/projs/ams_projs/esp32/esp-idf/components/ulp/component_ulp_common.mk:45: recipe for target 'ulp_main.elf' failed


This is weird because this is a very small assembly code to read a GPIO and wake up main CPU.

Code: Select all

/* ULP assembly files are passed through C preprocessor first, so include directives
   and C macros may be used in these files 
 */
#include "soc/rtc_cntl_reg.h"
#include "soc/rtc_io_reg.h"
#include "soc/soc_ulp.h"

    /* Define variables, which go into .bss section (zero-initialized data) */
    .bss

    /* RTC IO number used to sample the input signal.
        Set by main program. */
    .global io_number
    io_number:
    .long 0

    /* Code goes into .text section */
    .text
    .global entry
    entry:
    /* Read the value of lower 16 RTC IOs into R0 */
    READ_RTC_FIELD(RTC_GPIO_IN_REG, RTC_GPIO_IN_NEXT)
    /* Load io_number, extract the state of input */
    move r3, io_number
    ld r3, r3, 0
    rsh r0, r0, r3
    and r0, r0, 1
    move r2, 0x01
    sub r2, r2, r0
    /* State of input high? */
    jump wake_up, eq
    /* End program */
    halt

    .global wake_up
    wake_up:
    /* Check if the system can be woken up */
    READ_RTC_FIELD(RTC_CNTL_LOW_POWER_ST_REG, RTC_CNTL_RDY_FOR_WAKEUP)
    and r0, r0, 1
    jump wake_up, eq

    /* Wake up the SoC, end program */
    wake
    halt
Last edited by vinimac on Wed Aug 08, 2018 2:15 pm, edited 1 time in total.

ESP_Sprite
Posts: 8926
Joined: Thu Nov 26, 2015 4:08 am

Re: ulp_main.elf text not fit in ram

Postby ESP_Sprite » Tue Aug 07, 2018 3:50 am

Did you reserve memory for your program in make menuconfig? CONFIG_ULP_COPROC_RESERVE_MEM (Component config -> ESP32 specific -> select 'Enable Ultra Low Power Coprocessor' and make 'RTC slow memory reserved for coprocessor' non-zero.

Also note that you can actually wake up the CPU on a GPIO state change without using the ULP as well. Check the esp-idf sleep documentation for that.

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 96 guests