Board: BW16 Platform: Arduino Application: I plan to use the BW16 as a slave module for providing WiFi capabilities to another device, to do so I need a serial interface for the other device to control the BW16. Issues: The BW16 outputs debug information for both serial ports. According to what I’ve read in the forum disabling this debug output is not possible from a high level, but after checking the Arduino SDK source code it seems to be possible in low level.
I’ve tried to edit the SDK and compile again in Arduino but the adjustments are not reflected in the uploaded binaries, so it seems that my changes are not being compiled and instead it is using a static binary.. Question: Is it possible to modify the Arduino SDK an compile a new version? How can achieve this?
I’m changing line 151 of diag.h file in directory C:\Users\Colbits\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.6\system\component\soc\realtek\amebad\swlib\string, check below. I’m changing the initial words for the debug messages which are “RTL8721D[Driver]:”
If I redefined the DRIVER_PREFIX macro in the main.c file (where the setup and loop are called) I get warnings during the compilation process in the Arduino console so it seems that the compiler is aware of the changes. The compilation output can be found here, since it is too large to be copied here.
After the code is compiled, I erase the BW16’s flash and then load the program. After that, the debug messages still start with “RTL8721D[Driver]:” so the change had no effect.
Thanks for using arduino-cli like I suggested. This is an ideal way to dig into the Arduino SDK modifications as opposed to the IDE which is not designed for this line of work.
Here are the relevant errors regarding your change in main.c on lines 26 to 38.
C:\Users\Colbits\Downloads\MQTT_TLS\MQTT_TLS.ino:4:0: warning: “DRIVER_PREFIX” redefined #define DRIVER_PREFIX "defined in main.c "
In file included from C:\Users\Colbits\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.6\system/component/soc/realtek/amebad/fwlib/include/rtl8721d.h:22:0,
from C:\Users\Colbits\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.6\system/component/soc/realtek/amebad/fwlib/include/ameba_soc.h:13,
from C:\Users\Colbits\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.6\system/component/soc/realtek/amebad/cmsis/cmsis.h:35,
from C:\Users\Colbits\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.6\system/component/common/mbed/targets/hal/rtl8721d/PinNames.h:5,
from C:\Users\Colbits\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.6\variants\rtl8720dn_bw16/variant.h:29,
from C:\Users\Colbits\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.6\variants\rtl8720dn_bw16/pins_arduino.h:20,
from C:\Users\Colbits\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.6\cores\ambd/Arduino.h:135,
from C:\Users\Colbits\AppData\Local\Temp\arduino\sketches\0C2BE697C86EF580C250C25BDAD82F8F\sketch\MQTT_TLS.ino.cpp:1:
C:\Users\Colbits\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.6\system/component/soc/realtek/amebad/swlib/string/diag.h:151:0: note: this is the location of the previous definition #define DRIVER_PREFIX "EEEEEEEE[Driver]: "
Why don’t you remove that for now? Let’s focus on the diag.h file.
It’s important to remember that when doing any sort of embedded development with microcontrollers that you should often do a clean build.
Check this out:
-clean Optional, cleanup the build folder and do not use any cached build.
Maybe give that a shot and let me know?
By the way, I’m not associated with Realtek in anyway. I’m just trying to help.
Hello again,
I tried compiling using the CLI with the clean option enabled but no success. No redefined macros in main.c (MQTT_TLS.ino).
I used this command: arduino-cli compile --fqbn realtek:AmebaD:Ai-Thinker_BW16 --clean --verbose MQTT_TLS.ino This is the output (sorry, it is too large that isn’t allowed in Pastebin).
Still, the uploaded binaries (using CLI) are the same and no changes are effective. I guess that what @xidameng says here is related.