Code Monkey home page Code Monkey logo

imxrt-vscode-cmake-skelton's People

Contributors

akiyukiokayasu avatar

Watchers

 avatar  avatar

imxrt-vscode-cmake-skelton's Issues

リンカ周り

RAMオンリーやSDRAM対応など色々あるのでリンカファイル(.ld拡張子のもの)が、
MIMXRT1021/gccフォルダ内に複数生成される。

ビルド時にCMAKE_BUILD_TYPEでそれらを切り替えるようになっているっぽい。

cd build
cmake -DCMAKE_BUILD_TYPE=FLEXSPI_NOR_DEBUG ..

など。

ただ、この仕組みは汎用的だが、必要以上にややこしくなっているように思う。
CMAKE_BUILD_TYPEは普通DebugとReleaseくらいしか使わないので、うっかり正しいBUILD_TYPEの指定を忘れそう。

将来的にはflags.cmakeを使わずに、こんな感じに書き直してもいいのかもしれない。
これは適当に書いたものなので注意すること。
参考: https://mcuoneclipse.com/2021/05/04/visual-studio-code-for-c-c-with-arm-cortex-m-part-2/

#CMakeLists.txt
set(LINKER_FILE ${CMAKE_SOURCE_DIR}/MIMXRT1021/gcc/MIMXRT1021xxxxx_flexspi_nor.ld)
target_link_options(${EXECUTABLE} PRIVATE
        -T${LINKER_FILE}
        -mcpu=cortex-m7
        -mthumb
        -mfpu=fpv5-d16
        -mfloat-abi=hard
        -specs=nano.specs
        -specs=nosys.specs
        -lc
        -lm
        -lnosys
        -Wl,-Map=${PROJECT_NAME}.map,--cref
        -Wl,--gc-sections
        -Xlinker -print-memory-usage -Xlinker
        )

CMakeのVersionとLanguageをProject()のオプションで指定すべきか?

project(hoge
    VERSION 1.0.0
    LANGUAGES C CXX ASM)

と書いてしまえば

# ENABLE C/C++ ASM
ENABLE_LANGUAGE(C CXX ASM)

# THE VERSION NUMBER
SET (Tutorial_VERSION_MAJOR 1)
SET (Tutorial_VERSION_MINOR 0)

は不要になるはず。
ただ、projectのオプション指定だと新しめのCMakeのバージョンが必要なのかもしれない。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.