Skip to main content
SNorm.1
Associate III
August 25, 2021
Solved

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

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?

    This topic has been closed for replies.
    Peter BENSCH
    Peter BENSCHBest answer
    ST Technical Moderator
    August 25, 2021

    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.

    3 replies

    Peter BENSCH
    Peter BENSCHBest answer
    ST Technical Moderator
    August 25, 2021

    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.
    SNorm.1
    SNorm.1Author
    Associate III
    August 26, 2021

    Thank you very much!

    Tesla DeLorean
    Guru
    August 26, 2021

    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..