Add dmesg, compilation fixes
This commit is contained in:
parent
33b9bba2a9
commit
2fe2f93abc
@ -1,6 +1,6 @@
|
||||
include Makefile.inc
|
||||
|
||||
COMMON_FLAGS = -W -Wall -Wno-unused-parameter -Ipxtapp -fwrapv -fno-threadsafe-statics -Os
|
||||
COMMON_FLAGS = -W -Wall -Wno-unused-parameter -Ipxtapp -fwrapv -fno-threadsafe-statics -Os -mthumb
|
||||
CFLAGS = $(COMMON_FLAGS) -std=c99
|
||||
CXXFLAGS = $(COMMON_FLAGS) -std=c++11 -fno-rtti -fno-exceptions -fno-unwind-tables
|
||||
LDFLAGS = -Wl,--gc-sections -Wl,--sort-common -Wl,--sort-section=alignment
|
||||
@ -10,6 +10,7 @@ LD = $(PREF)gcc
|
||||
LIBSTDCPP = /usr/lib/gcc/arm-linux-gnueabi/4.9/libstdc++.a
|
||||
|
||||
EXE = bld/pxt-app.elf
|
||||
HEX = $(EXE:.elf=.hex)
|
||||
|
||||
DEPS = $(PXT_HEADERS) package.json Makefile Makefile.inc
|
||||
|
||||
@ -19,6 +20,7 @@ $(EXE): $(PXT_OBJS)
|
||||
$(LD) -o $(EXE) $(LDFLAGS) -Wl,-Map,$(EXE:.elf=.map) $(PXT_OBJS) $(LIBSTDCPP) -lm
|
||||
cp $(EXE) $(EXE:.elf=.full)
|
||||
$(PREF)strip $(EXE)
|
||||
node -p 'require("fs").readFileSync("$(EXE)").toString("hex")' > $(HEX)
|
||||
@ls -l $(EXE)
|
||||
|
||||
clean:
|
||||
|
@ -4,6 +4,18 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <cstdarg>
|
||||
|
||||
void dmesg(const char *format, ...) {
|
||||
char buf[500];
|
||||
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
vsnprintf(buf, sizeof(buf), format, arg);
|
||||
va_end(arg);
|
||||
|
||||
fprintf(stderr, "DMESG: %s\n", buf);
|
||||
}
|
||||
|
||||
namespace pxt {
|
||||
|
||||
@ -73,5 +85,4 @@ uint32_t afterProgramPage() {
|
||||
void dumpDmesg() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __PXTCORE_H
|
||||
#define __PXTCORE_H
|
||||
|
||||
//void codal_dmesg(const char *format, ...);
|
||||
#define DMESG(...) /* nothing */
|
||||
void dmesg(const char *fmt, ...);
|
||||
#define DMESG dmesg
|
||||
|
||||
#endif
|
||||
|
@ -3,9 +3,11 @@ let f = 0.5
|
||||
let plus = i + f
|
||||
let minus = i - f
|
||||
|
||||
let r = Math.random()
|
||||
let ri = Math.randomRange(5, 10)
|
||||
while (true) {
|
||||
let r = Math.random()
|
||||
serial.writeValue("R", r)
|
||||
loops.pause(1000)
|
||||
}
|
||||
|
||||
loops.forever(() => {
|
||||
loops.pause(100)
|
||||
})
|
||||
//loops.forever(() => {
|
||||
//})
|
||||
|
Loading…
Reference in New Issue
Block a user