[NXP Rapid IoT Review] Local compilation of online generated projects[Copy link]
On the web page of the project created by the online IDE rapid-iot-studio.nxp.com, there is a "Download" icon (to the left of the "Program" icon). (If the network is smooth) After clicking it, wait a while, the browser will pop up a prompt to download the file, and the website will send a .zip compressed package, which is the source code of this project. When I downloaded it for the first time, I noticed that the source code compressed package was over 10MB in size, which was strange. After unpacking it, I found that it was not just the project source code, but also all the dependent libraries (source files or compiled ones), so you don't need to download the SDK separately to use it. There are a lot of things in it:
A diff will make it clear - the difference between the two projects is mainly the content in the app_src directory. In addition, the only difference in the .project file (probably used by MCUExpresso) is the project name. As for why the two fxos8700.c files are different, I haven't figured it out yet. I didn't plan to use MCUExpresso IDE to compile it. I was going to analyze how to compile the code I needed to use by digging through the directory. Suddenly, I found a makefile file under the directory. Looking at its content, it happened to call the GCC tool chain, so I directly executed the make command to see the effect. It is also very likely to encounter problems. Sure enough, the ccache command (program) used in the compilation process was not there, but its function was not important, because it was followed by arm-none-eabi-gcc. I started to write a ccache.exe to pass the command line parameters to the specified program, but later I found that it was actually easier to just change the source.mk file referenced by the makefile (just replace the ccache text). In this way, make will directly call gcc to compile. Then I encountered another error. GCC reported that redlib.spec could not be found because the command line specified the spec file -D__REDLIB__ -specs=redlib.specs. Ugh, I had never heard of Redlib. So I deleted the -specs=redlib.specs option (changed it in the source.mk file) and tried to compile again. GCC gave a warning, saying that makefile is not a directory. Looking carefully, the option -I"makefile" appeared on the command line. It didn't make sense, so I changed source.mk and deleted it. After that, there were no compilation errors, but make only compiled one C file and stopped. Weird? I looked at the compilation target written in the makefile and thought that make main-build should be executed, so make started to compile many files... After a while, an error appeared. It was gcc saying that struct timeval was defined repeatedly. This error appeared in RapidIot_Base/middleware/wireless/nwk_ip/core/interface/sockets.h, and struct timeval has been defined in the C standard library. I remembered that the Redlib issue was probably caused by the difference between it and the Newlib used by my compiler. At present, I simply modify sockets.h and use the definition in the C standard library: (add conditional compilation instructions) #ifndef _SYS__TIMEVAL_H_ struct timeval { uint32_t tv_sec; /*!< seconds */ uint32_t tv_usec; /*!< microseconds */ }; /*!< Structure containing time information */ #endif The compilation continues in this way, and an error occurs when linking at the end: the script MK64FN1M0xxx12_connectivity.ld cannot be found. However, this is a small problem. I have seen this file under the directory tree, under the boards/rpk/mcux directory, and I can copy it over. The link is also passed, and a .axf file is obtained, which is actually an ELF file. I use objcopy to get the .bin file, which can be used for downloading. I compiled the downloaded "Rapid-IoT Out Of Box Demo", burned it in and it ran normally, with the same functions as the original one. Later I looked up what Redlib is, and the explanation is: