ESP32 带有 WIFI 功能,而众所周知要想让一个设备连接WIFI AP 需要告知设备对应 AP 的名称和密码,简单实验的话,可以直接在代码中写死这两个参数,但这种情况下烧写之后设备只能在固定的环境下使用。https://github.com/tzapu/wifimanager 这个项目可以解决上述问题。先说一下这个东西如何使用:
/**
Loads the non-volatile variables from the NvVars file on the
given file system.
@param[in] FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
@return EFI_STATUS based on the success or failure of load operation
**/
EFI_STATUS
LoadNvVarsFromFs (
EFI_HANDLE FsHandle
)
4.具体读取动作在ReadNvVarsFile() 函数中:
/**
Reads the contents of the NvVars file on the file system
@param[in] FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
@return EFI_STATUS based on the success or failure of the file read
**/
EFI_STATUS
ReadNvVarsFile (
IN EFI_HANDLE FsHandle
)
/**
Iterates through the variables in the buffer, and calls a callback
function for each variable found.
@param[in] CallbackFunction - Function called for each variable instance
@param[in] Context - Passed to each call of CallbackFunction
@param[in] Buffer - Buffer containing serialized variables
@param[in] MaxSize - Size of Buffer in bytes
@return EFI_STATUS based on the success or failure of the operation
**/
STATIC
EFI_STATUS
IterateVariablesInBuffer (
IN VARIABLE_SERIALIZATION_ITERATION_CALLBACK CallbackFunction,
IN VOID *CallbackContext,
IN VOID *Buffer,
IN UINTN MaxSize
)
The preprocessor directive %error will cause NASM to report an error if it occurs in assembled code. So if other users are going to try to assemble your source files, you can ensure that they define the right macros by means of code like this:
%ifdef F1
; do some setup
%elifdef F2
; do some different setup
%else
%error “Neither F1 nor F2 was defined.”
%endif
Then any user who fails to understand the way your code is supposed to be assembled will be quickly warned of their mistake, rather than having to wait until the program crashes on being run and then not knowing what went wrong.
Similarly, %warning issues a warning, but allows assembly to continue:
%ifdef F1
; do some setup
%elifdef F2
; do some different setup
%else
%warning “Neither F1 nor F2 was defined, assuming F1.”
%define F1
%endif
%error and %warning are issued only on the final assembly pass. This makes them safe to use in conjunction with tests that depend on symbol values.
%fatal terminates assembly immediately, regardless of pass. This is useful when there is no point in continuing the assembly further, and doing so is likely just going to cause a spew of confusing error messages.
It is optional for the message string after %error, %warning or %fatal to be quoted. If it is not, then single-line macros are expanded in it, which can be used to display more information to the user. For example:
之前介绍过的通过WinPE启动,通过软件将安装好的硬盘制作成镜像,然后当有需要时直接恢复的方法。但是更多时候我们出于测试的目的,需要安装最新版本的 Pure OS。 这次介绍的全自动安装也就是无人值守模式安装,就是说只需要启动到安装盘上,Windows会自动完成包括分区格式化在内的全部工作。这是Windows自带的功能,只需要将特定的autounattend.xml 放置在启动盘的根目录下即可。具体做法如下:
In file included from c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_facets_nonio.h:39,
from c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\locale:41,
from c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\iomanip:43,
from C:\Users\DaveX\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\libraries\BluetoothSerial\src\BTAddress.cpp:15:
c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\ctime:64:11: error: '::clock' has not been declared
using ::clock;
^~~~~
c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\ctime:65:11: error: '::difftime' has not been declared
using ::difftime;
^~~~~~~~
c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\ctime:66:11: error: '::mktime' has not been declared
using ::mktime;
^~~~~~
c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\ctime:67:11: error: '::time' has not been declared
using ::time;
^~~~
c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\ctime:68:11: error: '::asctime' has not been declared
using ::asctime;
^~~~~~~
c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\ctime:69:11: error: '::ctime' has not been declared
using ::ctime;
^~~~~
c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\ctime:70:11: error: '::gmtime' has not been declared
using ::gmtime;
^~~~~~
c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\ctime:71:11: error: '::localtime' has not been declared
using ::localtime;
^~~~~~~~~
c:\users\DaveX\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\ctime:72:11: error: '::strftime' has not been declared
using ::strftime;
^~~~~~~~