最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Arduino project on STM32 does not start - Stack Overflow

programmeradmin2浏览0评论

I have a project in arduino written for my stm32 f411re. You can see parts of it below:

#include "Utils.h"
#include "MotionControl.h"
#include "SettingsAndUi.h"
#include "Menu.h"
#include "Buttons.h"
#include "Arduino.h"

void setup() {
  Serial.begin(115200);
  Serial.println("init start");
  // initUi();
  // startCheckingUiEncoders();
  Serial.println("init 1");
  // initButtons();
  Serial.println("init 2");
  // initMotionControl();
  Serial.println("init 3");
  Serial.println("init done");
}

void loop() {
  // tickButtons();
  if (valueEncoderClicks != 0) {
    int32_t offset = valueEncoderClicks;
    valueEncoderClicks = 0;
    // modifyValue(offset, fine);
  }
  if (menuEncoderClicks != 0) {
    int32_t offset = menuEncoderClicks;
    menuEncoderClicks = 0;
    // modifyItemIndex(offset);
  }
  // outputToSerial();
  // steppers.run();
  // refreshCoordinatesUI();
}

As you can see, i have put most functionality into separate files, to tidy it up a little. And I commented out most of the fun stuff, so it consists of barely more then Serial.println(). Which works fine. The output is init start ... init 1 ... init 3 ... init done just as expected. I uncommented the real functionality step by step, redeploying after each step and it works to a certain point until one line breaks the hole thing and it does not even start any more. It compiles, it deploys but it does not start.

I wasted a lot of time investigating that line without finding a bug. But here is at least some hint. If I change up the order of my step by step uncommenting process. It fails at a diffrent line. I tried this in a number of different orders and got a variety of diffrent points of failure. It's always a diffrent line but the same behavior. Compile works, deploy works, start up not at all.

My conclusion is that somehow the compiler or linker produce an invalid binary of sorts. Maybe it's heap or code section are to big or in the wrong order or at a bad offset. C++ compilation isn't really my strong suit. I'd really appreciate any hints you might have.

发布评论

评论列表(0)

  1. 暂无评论