Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
public:development:arduinoide [2022/06/16 12:51] jsanchez created |
public:development:arduinoide [2024/10/09 08:53] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
# ArduinoIDE | # ArduinoIDE | ||
- | {{tag> arduino iot development}} | + | {{tag> arduino iot development |
# ArduinoIDE portable | # ArduinoIDE portable | ||
Line 168: | Line 168: | ||
- Exit Picocom with `Ctrl+A`, `Ctrl+X`. | - Exit Picocom with `Ctrl+A`, `Ctrl+X`. | ||
+ | |||
+ | |||
+ | # Meter código C en Arduino | ||
+ | |||
+ | Se pueden meter archivos `.c` y sus respectivos `.h` en el mismo directorio que el sketch: | ||
+ | |||
+ | Fuente: https:// | ||
+ | |||
+ | C++, which the Arduino is programmed in, performs name-mangling. C, which your external functions are written in, does not. | ||
+ | |||
+ | Name-mangling means that the actual function that gets called is called using a name that is composed of the class name, function name, and argument type names. | ||
+ | |||
+ | In order to call a C function from a C++ function, the compiler needs to know that it should use C calling syntax, not C++ calling syntax. | ||
+ | |||
+ | In the header file, before any function declarations, | ||
+ | |||
+ | ``` | ||
+ | #ifdef __cplusplus | ||
+ | extern " | ||
+ | #endif | ||
+ | ``` | ||
+ | |||
+ | |||
+ | After all function declarations, | ||
+ | |||
+ | ``` | ||
+ | #ifdef __cplusplus | ||
+ | } | ||
+ | #endif | ||
+ | ``` | ||
+ | |||
+ | This will allow the C functions to be called from C++. | ||
+ | |||
+ | **IMPORTANT** Make sure that the files that you are compiling appear in the ArduinoIDE as tabs. If not, the compiler does not recognize them. Always rename your `.c` files to `.cpp`. | ||
+ | |||
+ | |||
+ | # Code Footprint | ||
+ | |||
+ | Reducir el tamaño de los firmwares | ||
+ | |||
+ | Por defecto, arduino le pasa al compilador el Flag `-g`, este flat añade a los archivos `.o` varios campos de depuración, | ||
+ | que son listados en el `.map` como `.debug_info`, | ||
+ | tamaño del firmware. | ||
+ | |||
+ | Para eliminar el código de depuración de los archivos objeto, editar el archivo `platform.txt` y quitar la opción | ||
+ | `-g` de todos los flags de compilación. | ||
+ | |||
+ | |||
+ | - Los flags de compilación se encuentran en el archivo `platform.txt`, | ||
+ | |||
+ | E.g.: | ||
+ | |||
+ | ``` | ||
+ | arduino-1.8.0/ | ||
+ | ``` | ||
+ | |||
+ | Luego compilar los firmwares respectivos, | ||
+ | |||
+ | ``` | ||
+ | python3 ~/ | ||
+ | ``` | ||
+ | |||
+ | Los archivos que pertenecen a cada una de las partes del código están listados en el readme de cada firmware. | ||
+ | |||
+ | |||
+ | Ejemplo de lo que estamos hablando: | ||
+ | |||
+ | |||
+ | ``` | ||
+ | |||
+ | Coap | ||
+ | |||
+ | |||
+ | / | ||
+ | |||
+ | |||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | TOTAL : 7989 : 927 : 8916 | ||
+ | |||
+ | / | ||
+ | / | ||
+ | TOTAL : 2213 : 358 : 2571 | ||
+ | |||
+ | ### PANA | ||
+ | |||
+ | |||
+ | / | ||
+ | |||
+ | |||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | TOTAL : 6639 : 947 : 7586 | ||
+ | |||
+ | / | ||
+ | / | ||
+ | TOTAL : 2213 : 358 : 2571 | ||
+ | |||
+ | ``` | ||
+ | |||
+ |