生成px4的命令
cd /home/yangang/work/px4/Firmware/build/px4-stm32f4discovery_default/platforms/nuttx && /usr/bin/python /home/yangang/work/px4/Firmware/Tools/px_mkfw.py --prototype /home/yangang/work/px4/Firmware/platforms/nuttx/Images/px4-stm32f4discovery.prototype --git_identity /home/yangang/work/px4/Firmware --parameter_xml /home/yangang/work/px4/Firmware/build/px4-stm32f4discovery_default/parameters.xml --airframe_xml /home/yangang/work/px4/Firmware/build/px4-stm32f4discovery_default/airframes.xml --image px4-stm32f4discovery.bin > /home/yangang/work/px4/Firmware/build/px4-stm32f4discovery_default/px4-stm32f4discovery_default.px4
int vfprintf(FAR FILE *stream, FAR const IPTR char *fmt, va_list ap)
{
struct lib_stdoutstream_s stdoutstream;
int n = ERROR;
if (stream)
{
/* Wrap the stream in a stream object and let lib_vsprintf
* do the work.
*/
lib_stdoutstream(&stdoutstream, stream);
/* Hold the stream semaphore throughout the lib_vsprintf
* call so that this thread can get its entire message out
* before being pre-empted by the next thread.
*/
lib_take_semaphore(stream);
n = lib_vsprintf(&stdoutstream.public, fmt, ap);
lib_give_semaphore(stream);
}
return n;
}
fputc
int fputc(int c, FAR FILE *stream)
{
unsigned char buf = (unsigned char)c;
int ret;
ret = lib_fwrite(&buf, 1, stream);
//写入
if (dev->isconsole)
{
irqstate_t flags = enter_critical_section();
ret = uart_irqwrite(dev, buffer, buflen);
leave_critical_section(flags);
return ret;
}
else
{
//printfc
uart_putc('\r');
#define uart_putc(ch) up_putc(ch)
# define showprogress(c) up_lowputc(
//调用书还出
int up_putc(int ch)
{
#if CONSOLE_UART > 0
struct up_dev_s *priv = uart_devs[CONSOLE_UART - 1];
uint16_t ie;
up_disableusartint(priv, &ie);
void up_lowputc(char ch)
{
#if defined HAVE_UART_DEVICE && defined HAVE_SERIAL_CONSOLE
/* Wait for the transmitter to be available */
while ((getreg32(CONSOLE_BASE+A1X_UART_LSR_OFFSET) & UART_LSR_THRE) == 0);
/* Send the character */
putreg32((uint32_t)ch, CONSOLE_BASE+A1X_UART_THR_OFFSET);
#endif
}