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

Incomplete documentation of mos.yml. What are "Modules"? #30

Open
Harvie opened this issue Feb 13, 2020 · 1 comment
Open

Incomplete documentation of mos.yml. What are "Modules"? #30

Harvie opened this issue Feb 13, 2020 · 1 comment

Comments

@Harvie
Copy link

Harvie commented Feb 13, 2020

Hello,
i am looking at mos.yml format reference:
https://mongoose-os.com/docs/mongoose-os/userguide/build.md#mosyml-file-format-reference
and i am also looking at https://github.com/mongoose-os/mos/blob/master/cli/build/manifest.go

And there are several features, which deserve better documentation IMO. Eg.:

	ExtraFiles     []string           `yaml:"extra_files,omitempty" json:"extra_files"`
	FFISymbols     []string           `yaml:"ffi_symbols,omitempty" json:"ffi_symbols"`
	Tests          []string           `yaml:"tests,omitempty" json:"tests"`
	Modules        []SWModule         `yaml:"modules,omitempty" json:"modules"`
	ModulesVersion    string `yaml:"modules_version,omitempty" json:"modules_version"`
	InitAfter      []string           `yaml:"init_after,omitempty" json:"init_after"`
	InitBefore     []string           `yaml:"init_before,omitempty" json:"init_before"`
	Conds []ManifestCond `yaml:"conds,omitempty" json:"conds"`
	ManifestVersion string `yaml:"manifest_version,omitempty" json:"manifest_version"`
	LibsHandled []FWAppManifestLibHandled `yaml:"libs_handled,omitempty" json:"libs_handled"`
	InitDeps []string `yaml:"init_deps,omitempty" json:"init_deps"`

InitAfter, InitBefore, ManifestVersion is kinda obvious (well i don't know which manifest version should i use, which is latest), but these are still not documented on that page i've linked.

The rest fo the keywords is rather mystery to me. Especialy i would like what are modules and how they are different from libs. What are ExtraFiles and how do i use Tests or Conds? LibsHandled and InitDeps i don't know at all what these are.

@Harvie Harvie changed the title Incomplete documentation of mos.yml Incomplete documentation of mos.yml. What are "Modules"? Feb 13, 2020
@cpq
Copy link
Contributor

cpq commented Feb 14, 2020

Modules are libraries which are not mongoose-os libraries. I.e. these are the libraries that do not have mos.yml. In other words, these are just normal C/C++ packages/libraries which do not know about mongoose-os.

Thus, if you want to use some external C library, use modules. The syntax is the same as for libs, a module should be a git repo.

You can use a module directly in your firmware, or you can create a wrapper mongoose-os library. For example, https://github.com/mongoose-os-libs/mjs is a mongoose-os library. It uses a JS engine pulled as a module - see mos.yml.

Conds is the mechanism to apply things based on conditions. For example, adc library includes extra functionality for esp32 platform: https://github.com/mongoose-os-libs/adc/blob/master/mos.yml#L16

Or, you can include extra libs, or define different config params depending on conditions. A great example is a https://github.com/mongoose-os-libs/boards which is a "library" that does not have any code, but consists purely of conditions in mos.yml.

If you include boards library in your mos.yml and then build your firmware via mos build --build-var BOARD=B-L475E-IOT01A, a big section of specific settings https://github.com/mongoose-os-libs/boards/blob/master/mos.yml#L136-L194 will be applied that are specific for STM32 IOT01A board.

If you feel like it, send a PR against https://github.com/cesanta/mongoose-os-docs/blob/master/mongoose-os/userguide/build.md

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

2 participants