cancel
Showing results for 
Search instead for 
Did you mean: 

i use to work with c51 mpu by keil ide and I moved to STM32cubeide. IM LOOKING FOR A REPLACMENT OPERAND FOR "_AT_" AND FOR THE TYPE "XDATA". Does anyone know any?

Gbasi.1
Associate II

#define RAM_Image 0x0300

xdata u8 DACT_A _at_ RAM_Image+0x0006;

xdata u8 DACT_B _at_ RAM_Image+0x0007;

DACT_A = 5;

DACT_B =6;

when DAC_A and DAC_B are global.

1 REPLY 1

People don't usually code using such archaic/crude ways, try to use more regular C programming methods rather than trying to crowbar an 8051 mindset into 32-bit C environments.

Typically you'd use a struct to describe memory like this, and use a pointer to it, rather than try to manually micro-manage it.

That way you let the compiler/linker do the work, like they were designed, and it is actually somewhat portable.

You can describe memory regions in the Linker Script (.LD) and direct content with __attribute__

uint8_t foo[1024] __attribute__ ((section ("XDATA")));

https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Variable-Attributes.html

One could also do this

uint8 *dact_a = (uint8_t *)(RAM_Image+0x0006);

#define DACT_A (*dact_a)

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