logo elektroda
logo elektroda
X
logo elektroda

Basic use of the arm-none-eabi toolchain or what happens before main

_lazor_ 10965 31
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #31 17613293
    _jta_
    Electronics specialist
    A Klonano (Arduino Nano clone) on Nettigo PLN 15.9. "Blue Pill", a module with STM32F103C8T6 on Allegro from PLN 13.9, but you have to combine to connect.
  • ADVERTISEMENT
  • #32 17744022
    _lazor_
    Moderator of Designing
    _jta_ wrote:
    Of course, in the code above, this is redundant

    This is not redundant, on the contrary, it is necessary if the name is to be used to generate the 32-bit address of the function - the fact that the processor has only Thumb instructions does not mean that you can load an even address into the PC with impunity - it freezes the processor, I checked.

    I used this construction, and it worked:
    Code: ARM assembler
    Log in, to see the code

    - all functions defined by _func had odd addresses.

    However, the problem with (non)parity of the address only manifests itself when the instruction uses a 32-bit address - instructions containing a relative address do not encode the lowest bit of the address and preserve the lowest PC bit.


    I finally got to the source of the problem. The address in the PC must be aligned to a half word or word, i.e. it must be even, but there is one reason why you need to set 1 for the least significant bit - legacy reason. Although the architecture does not support the ARM instruction, you still need to denote the one on the least significant bit that we have thumb instruction set.

    https://www.embedded.com/electronics-blogs/be...er-s-corner/4024632/Introduction-to-ARM-thumb

    "Since all ARM instructions will align on either a 32- or 16-bit boundary, the LSB of the address is not used in the branch directly. However, if the LSB is 1 when branching from ARM state, the processor switches to Thumb state before it begins executing from the new address; if 0 when branching from Thumb state, back to ARM state it goes."

Topic summary

The discussion revolves around the use of the arm-none-eabi toolchain for programming microcontrollers, specifically focusing on the startup code that executes before the main function. Participants share insights on development environments, with suggestions for using Eclipse with the GNU MCU Eclipse plugin for easier project setup. The conversation highlights the advantages of STM32 microcontrollers, such as mature development environments, cost-effective boards, and code portability. There are debates on the ease of programming 8-bit versus 32-bit microcontrollers, with some arguing that modern 32-bit systems offer more intuitive programming experiences despite their complexity. The topic also touches on debugging options, reset types in Cortex-M, and the importance of understanding the boot procedure. Additionally, there are discussions about the availability and pricing of various STM32 boards compared to Arduino clones.
Summary generated by the language model.
ADVERTISEMENT