cancel
Showing results for 
Search instead for 
Did you mean: 

Running a function on ram

OguzhanBalci
Associate III

#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?


1 ACCEPTED SOLUTION

Accepted Solutions

>>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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

>>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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks