A Bunch of Questions from First Time MODM User #1065
-
Okay, I've been experimenting with MODM for a few days, and been really impressed so far. But I've accumulated a bunch of questions, and haven't found the answers in brief searches (it may be I'm searching in the wrong places). I should also point out that while I'm comfortable with C and Python, I've only been applying C++ to embedded systems for the past year or so, and am completely unfamiliar with the LBUILD system. I suspect a bunch of my questions can be solved by digging deeper into that. If this laundry list of questions would be better to post on issues, and/or broken up into multiple questions, let me know. InstallationThe directions in the README of the main repo correctly call out a recursive git clone of the MODM repository. But the instructions for making a custom project only call out the basic Custom BSPSo far I'm experimenting with standard dev boards, but I will need to define a custom BSP. I follow the gist of the instructions for making a BSP, but one thing confuses me. The instructions offer two approaches, copy and modify an existing BSP, or make your own completely from scratch. I'm shooting for the former. The instructions hint at copying an existing BDP directory into your own project and modifying it. I can't figure out how to make that work. What was successful was to make a new BSP directory in the MODM tree, but that causes another problem (see FORKING below). I may be misreading the custom BSP instructions, because it also could be interpreted as "copy all the stuff from an existing BSP and insert it (unclear how/where) in your own project. I started with that approach, actually, and very quickly realized I didn't know enough. That's when I tried just duplicating an existing BSP in the native MODM directory tree, which seems to work. How are you supposed to use a BSP directory that is copied / modified into your project's directory tree structure? InheritA couple places the docs talk about "inheriting" the results of Project Directory Tree StructureI was a little unclear about some points of the recommended tree structure. I thought that I would browse some of the existing MODM projects listed here. I couldn't find any project that used the recommended structure. Anyway, I think I have a good grasp on that now. Compiler / Linker TweaksI found the ability to add custom CFLAGS and CCFLAGS into the const char bootloader_version[BLVERSION_SIZE] __attribute__((at(0x8000200))) = VERSION; I figured out how to do this in ARM-NONE-EABI-GCC/G++, but it will require tweaking the linker load script. I'm hoping I can do that from the .xml file rather than tweaking the SCONS or MAKE files post LBUILD. UART QueuesOne common thing is to know how many bytes are in the UART queues. It doesn't look like the normal UART class exposes this to the application. I haven't tried yet, but the Queue class does have a ForkingSo, because of the recommended directory tree, MODM is now in your project as a submodule. That's fine. But when I thought I had to modify the boards directory, it opens a can of worms. I forked MODM so that I could push my own modified copy. But as I quickly discovered, MODM itself is comprised of a bunch of submodules. In the case of modifying the board folder, that's in the main MODM repo. But if one needed to tweak any of the submodules of MODM, that gets messy -- you have to fork each submodule of interest as well. What's the intended approach to forking the MODM repo, with respect to the submodules? Hopefully, I won't care about this and find out I can put my modified BSP in my project folder instead. Overall, I'm finding the documentation adequate. The actual API stuff you need in your application is documented the best. It's the documentation on the surrounding bits and pieces that I'm missing. And most of that may be my unfamiliarity with LBUILD. The Guide section is really good and helpful, but I think it could be expanded a little. That's all for now. Next up is to figure out how to talk to the NVIC peripheral. EDIT: I forgot one thing. In my makefiles, I usually have more granular control that seems possible from the LBUILD-generated makefile. For example, I can't just compile one file, like Also, when it comes to programming my chip from the makefile, I usually add a bunch of targets. For example:
I can only see the PROGRAM option being generated from LBUILD. Is there a way to add my own targets, like above? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yes, good point, do you want to add this directly to the documentation as your first PR? You don't have to, it's just a neat way to contribute and you can do it entirely online.
BSPs are not special in modm, they are a configuration file that you can extend and a bunch of files that get included automatically. But I recommend to just use your fork with the customized BSP inside modm, it's the path of least resistance, particularly when your new. It's also not wrong to do it that way.
Ah, that's indeed a bit unclear. This refers to the
The code that builds the alias list is here btw. It also autodiscovers your custom BSP inside modm.
Ooops. I think we added this guideline relatively late and a bunch of people already started doing their own organization. We should really resurrect our git template that you could just fork to get started. GitHub had an issue for several years where submodules in templates did not get forked correctly, but I think they fixed it now.
Yes, you can overwrite the linkerscript path with the Sadly GNU ld is not as powerful as the commercial embedded linkers from Keil or Segger. Flood filling, compression, explicit placement policies are all not really available… sad.
Nope, the interface was not build for that. They are not even publicly linked. I would recommend copying the generated UART driver into your application and modifying it. modm is very modular, so you can replace the
It's just a way to point out that the uart is used exclusively for the STLink that's soldered onto the dev board. You don't need to follow that naming scheme for your own board, nothing in modm depends on that. The board uses it to define the logger and connect that to the IO streams. You have to define that manually for your board.
True, but all our submodules are external projects that are pruned to minimal size. We usually try to avoid forking external projects. If we need to modify something, we can use lbuild to add/replace files. All external submodule projects are automatically updated in modm-ext.
You shouldn't need to touch them. Your modm fork will just use the submodules, they don't need to be forked themselves. If you want to add an external project, here's a small guide.
lbuild has a bunch of documentation itself. It's basically a modern take on the typical KConfig + CPP combo: here it's Python + Jinja2. It just allows way more flexibility in managing such a complex configuration for thousands of targets. Also way easier to generate docs from it ;-P
(modm implements the CMSIS functions.)
We typically use SCons, but it's quite inscrutible sometimes. Therefore I added the
Sure, you can modify the Makefile and set the |
Beta Was this translation helpful? Give feedback.
No, lbuild already does too much and build system customization is too complicated to abstract. The escape hatch is adapting the top-level Makefile/SConstruct and telling lbuild not to overwrite it. We recommend that you commit the generated sources incl. the Makefile for that purpose (and to check what changed when upgrading modm).