Skip to main content
Graduate
April 2, 2024
Solved

Running a function on ram

  • April 2, 2024
  • 1 reply
  • 775 views

#define EEPROM_SEC __attribute__((long_call, section("EepromSection")))

EEPROM_SEC
int add(int a, int b) {
return a + b;
}
static __attribute__(( aligned(32))) uint32_t code_buf[20] = { 0 };
//...

int main(void) {
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_I2C1_Init();


EEPROM_Init();
printf(add);//If I do not do this despite all my efforts, the compiler ignores the add function

EEPROM_Read(code_buf, 64, 0);

int (*my_summer)(int, int);

my_summer = ((uint32_t *)(code_buf));
my_summer(100, 20);

while (1) {
}

}

error causing code(asm) : push {r7}
What do you think I'm doing wrong?


    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    >>What do you think I'm doing wrong?

    There are a lot of moving parts here, and you're quite a way from getting everything correct.

    https://community.st.com/t5/stm32-mcus-products/help-with-load-amp-executing-code-into-stm32-mcu-ram/m-p/643780

    1 reply

    Graduate II
    April 2, 2024

    >>What do you think I'm doing wrong?

    There are a lot of moving parts here, and you're quite a way from getting everything correct.

    https://community.st.com/t5/stm32-mcus-products/help-with-load-amp-executing-code-into-stm32-mcu-ram/m-p/643780

    Graduate
    April 2, 2024

    Thanks