Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile for STM8AF52xx #55

Open
techolga opened this issue May 13, 2022 · 1 comment
Open

Unable to compile for STM8AF52xx #55

techolga opened this issue May 13, 2022 · 1 comment

Comments

@techolga
Copy link

Hi,
I tried to get a custom Board running when I realized that I am not able to compile for targets with longer label than 8 characters.

"-D%s" % board_config.get("build.mcu")[0:8].upper(),

I tried to use board_build.mcu = stm8af52ax in platform.ini and the SPL needs to have STM8AF52Ax to be defined. There are several targets that have a different definition schema.

 /* #define STM8S208 */      /*!< STM8S High density devices with CAN */
 /* #define STM8S207 */      /*!< STM8S High density devices without CAN */
 /* #define STM8S007 */      /*!< STM8S Value Line High density devices */
 /* #define STM8AF52Ax */    /*!< STM8A High density devices with CAN */
 /* #define STM8AF62Ax */    /*!< STM8A High density devices without CAN */
 /* #define STM8S105 */      /*!< STM8S Medium density devices */
 /* #define STM8S005 */      /*!< STM8S Value Line Medium density devices */
 /* #define STM8AF626x */    /*!< STM8A Medium density devices */
 /* #define STM8AF622x */    /*!< STM8A Low density devices */
 /* #define STM8S103 */      /*!< STM8S Low density devices */
 /* #define STM8S003 */      /*!< STM8S Value Line Low density devices */
 /* #define STM8S903 */      /*!< STM8S Low density devices */
 /* #define STM8S001 */      /*!< STM8S Value Line Low denisty devices */

A similar problem could appear with the arduino framework.

LIBS=[board_config.get("build.mcu")[0:8].upper()],

Also I found the stm8flash target to not fit

flash_target = board_config.get("upload.stm8flash_target", mcu[:8] + "?" + mcu[9])

correct target would be stm8af52a? according to https://github.com/vdudouyt/stm8flash

@techolga
Copy link
Author

I solved the flash target with setting "stm8flash_target": "stm8af52A?" in the upload section of my board.json.

for the define flag I went with the following:

    build_mcu = board_config.get("build.mcu")[:9].upper()
    if build_mcu[5] == 'S':
        build_mcu = build_mcu[:8]
    else:
        build_mcu += 'x'

    command = [
        env.subst("$CC"), "-m%s" % board_config.get("build.cpu"),
        "-D%s" % build_mcu,
        "-I.", "-I", "%s" % env.subst("$PROJECT_SRC_DIR"),
        "-Wp-MM", "-E", "stm8s.h"
    ]

techolga added a commit to techolga/platform-ststm8 that referenced this issue May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant