cancel
Showing results for 
Search instead for 
Did you mean: 

Do I need to use Xdata, idata to define variables in programming?

SNorm.1
Associate III

When I use the 51 kernels, if I encounter too many defined variables, especially when there are more arrays, I can use xdata,idata to define variables, but I don't know if I can use them with STM32?

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

The 8051 core was developed in the late 1970s, uses several address spaces due to core limitations and is therefore not comparable to modern microcontrollers.

With STM32 you can address the entire available RAM and place variables there; you no longer have to define memory types such as XDATA or IDATA - they are unknown to the compiler anyway.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
Peter BENSCH
ST Employee

The 8051 core was developed in the late 1970s, uses several address spaces due to core limitations and is therefore not comparable to modern microcontrollers.

With STM32 you can address the entire available RAM and place variables there; you no longer have to define memory types such as XDATA or IDATA - they are unknown to the compiler anyway.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thank you very much!

The 32-bit address space is 4GB, that's not fully populated, but the code and data sections tend to be large linear regions.

The linker script can define and name sections of memory, and you can use __attribute__ to use them, as appropriate.

The demaractions here tend to be for internal/external memories, or the distance from the core.

College level texts on 32-bit architectures might be worth review as these things can be significantly more complex than old 8-bit architectures.

Peripherals are mapped within the same 4GB address space, as memories. Access to peripherals is typically done through structures as the multiple instances tend to be a step-and-repeat implementation.

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