Using Arduino Compat library

#1

Hi All, I’m trying to port a medium complex Arduino project to Mongoose. To do this, I created an empty C project using mos and then I modified the yml file to include:

(under libs)

- origin: https://github.com/mongoose-os-libs/arduino-compat

and also:

tags:
  - c
  - arduino
  - arduino-core

I also renamed the main.ino file to main.cpp.

When I run “mos build” it fails, with the only hint of error being a line that says:

/data/fwbuild-volumes/2.15.0/apps/RP4N-N2K/esp32/build_contexts/build_ctx_034998573/deps/modules/mongoose-os/platforms/esp32/src/esp32_src.mk:111: recipe for target 'main.o' failed
make[1]: *** [main.o] Error 1

I’ll post the entire yml file and and the full result below.

My thought is that my project uses a library that is not part of Arduino core, a 3rd party open source library, and that I somehow need to get that included in this build.

I would appreciate any suggestions, thank you very much. I’m also trying to build smaller, sample Arduino projects and see if I can isolate any particular library that’s an issue, although trial and error will be slow.

yml file:

author: mongoose-os
description: A Mongoose OS app skeleton
version: 1.0

libs_version: ${mos.version}
modules_version: ${mos.version}
mongoose_os_version: ${mos.version}

# Optional. List of tags for online search.
tags:
  - c

# List of files / directories with C sources. No slashes at the end of dir names.
sources:
  - src

# List of dirs. Files from these dirs will be copied to the device filesystem
filesystem:
  - fs

libs:
  - origin: https://github.com/mongoose-os-libs/boards
  - origin: https://github.com/mongoose-os-libs/ca-bundle
  - origin: https://github.com/mongoose-os-libs/rpc-service-config
  - origin: https://github.com/mongoose-os-libs/rpc-service-fs
  - origin: https://github.com/mongoose-os-libs/rpc-uart

  # Added by JWA
  - origin: https://github.com/mongoose-os-libs/arduino-compat

tags:
  - c
  - arduino
  - arduino-core
  
# Used by the mos tool to catch mos binaries incompatible with this file format
manifest_version: 2017-09-29

Build result:

*** Its too big to post in the body…

#2

The process of converting an Arduino project to Mongoose OS is not as simple as renaming *.ino to *.cpp. All the libraries have to be ported to Mongoose OS format. The arduino-compat layer provides only a part of Arduino API. Here is the list of the ported libraries.

There must be more errors before the one you posted here. Use https://pastebin.com/ or similar and post the link here.

#3

Thanks for the info… I’ll study the procedure for porting libraries.

Pastebin looks pretty cool! I created a paste with the build output:

Build Output

#4

Towards the end of the log

/src/polar1.cpp:64:18: fatal error: FS.h: No such file or directory
   #include "FS.h"
#5

Thanks very much I missed that.

I noticed that the arduino compatible library seems to work for main.cpp but other not other source files. I could be wrong, I’m working on it.

I think I’ll try to rewrite the SD card routines using the Mongoose libraries and go from there.

Thanks again.

#6

Ah, I just found this:

[https://github.com/nliviu/sdlib](https://github.com/nliviu/sdlib)

I’ll give it a spin thanks for your contribution!