Skip to content

Commit

Permalink
ulog support done
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuxingliang committed Oct 19, 2019
1 parent b3a0d72 commit 73a4040
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 2,042 deletions.
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "src/printf"]
path = src/printf
url = https://github.com/mpaland/printf
url = https://gitlab.com/XuNeo/printf.git
[submodule "src/app/ulog-noos"]
path = src/app/ulog-noos
url = https://gitlab.com/XuNeo/ulog-noos.git
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"functional": "c",
"displed.h": "c",
"menu.h": "c",
"hmi.h": "c"
"hmi.h": "c",
"syslog.h": "c",
"ulog.h": "c"
},
}
14 changes: 6 additions & 8 deletions src/MDK/AD5791Ref.uvoptx
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>DLGUARM</Key>
<Name>燩鷙愞b
燩鷙愞b
</Name>
<Name>燩鷙</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
Expand Down Expand Up @@ -165,7 +163,7 @@
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>pstr</ItemText>
<ItemText>log_buf</ItemText>
</Ww>
<Ww>
<count>1</count>
Expand Down Expand Up @@ -211,8 +209,8 @@
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>2</SubType>
<ItemText>0x8006000</ItemText>
<SubType>8</SubType>
<ItemText>0x20000438</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
Expand Down Expand Up @@ -779,7 +777,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\app\ulog\ulog.c</PathWithFileName>
<PathWithFileName>..\app\ulog-noos\ulog.c</PathWithFileName>
<FilenameWithoutPath>ulog.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
Expand All @@ -791,7 +789,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\app\ulog\backend\console_be.c</PathWithFileName>
<PathWithFileName>..\app\ulog-noos\backend\console_be.c</PathWithFileName>
<FilenameWithoutPath>console_be.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
Expand Down
10 changes: 5 additions & 5 deletions src/MDK/AD5791Ref.uvprojx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\OUT\</OutputDirectory>
<OutputName>PowerV7</OutputName>
<OutputName>ad5791-ref</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
Expand Down Expand Up @@ -336,9 +336,9 @@
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls>--preinclude ..\stm32f0xx_conf.h </MiscControls>
<Define>STM32F030,USE_STDPERIPH_DRIVER,M_PI=3.14159265358979f</Define>
<Define>STM32F030,USE_STDPERIPH_DRIVER,M_PI=3.14159265358979f,__CLK_TCK=100</Define>
<Undefine></Undefine>
<IncludePath>..\..\stm32f0xxlib\CMSIS\Device\ST\STM32F0xx\Include;..\..\stm32f0xxlib\STM32F0xx_StdPeriph_Driver\inc;..\..\src;..\..\src\app;..\..\src\bsp;..\printf;..\app\ulog;..\app\ulog\syslog</IncludePath>
<IncludePath>..\..\stm32f0xxlib\CMSIS\Device\ST\STM32F0xx\Include;..\..\stm32f0xxlib\STM32F0xx_StdPeriph_Driver\inc;..\..\src;..\..\src\app;..\..\src\bsp;..\printf;..\app\ulog-noos</IncludePath>
</VariousControls>
</Cads>
<Aads>
Expand Down Expand Up @@ -595,12 +595,12 @@
<File>
<FileName>ulog.c</FileName>
<FileType>1</FileType>
<FilePath>..\app\ulog\ulog.c</FilePath>
<FilePath>..\app\ulog-noos\ulog.c</FilePath>
</File>
<File>
<FileName>console_be.c</FileName>
<FileType>1</FileType>
<FilePath>..\app\ulog\backend\console_be.c</FilePath>
<FilePath>..\app\ulog-noos\backend\console_be.c</FilePath>
</File>
</Files>
</Group>
Expand Down
33 changes: 19 additions & 14 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,39 @@ LDSCRIPT := ./STM32F030F4.ld
SOURCE := $(wildcard ./*.c)
SOURCE += $(wildcard ./bsp/*.c)
SOURCE += $(wildcard ./app/*.c)
SOURCE += $(wildcard ./app/ulog-noos/*.c)
SOURCE += $(wildcard ./app/ulog-noos/backend/*.c)
SOURCE += $(wildcard ./printf/*.c)
SOURCE += $(wildcard ../stm32f0xxlib/STM32F0xx_StdPeriph_Driver/src/*.c)

SOURCE_ASM := ../src/startup_stm32f030.s

INC_DIR := -I./
INC_DIR += -I../src
INC_DIR += -I../stm32f0xxlib/CMSIS/Include
INC_DIR += -I../stm32f0xxlib/CMSIS/Device/ST/STM32F0xx/Include
INC_DIR += -I../stm32f0xxlib/STM32F0xx_StdPeriph_Driver/inc
INC_DIR += -I./app
INC_DIR += -I./bsp
INC_DIR += -I./printf
INC_DIR += --include ./stm32f0xx_conf.h
INC_DIR += -I../stm32f0xxlib/CMSIS/Include
INC_DIR += -I../stm32f0xxlib/CMSIS/Device/ST/STM32F0xx/Include
INC_DIR += -I../stm32f0xxlib/STM32F0xx_StdPeriph_Driver/inc
INC_DIR += -I./app
INC_DIR += -I./app/ulog-noos
INC_DIR += -I./bsp
INC_DIR += -I./printf
INC_DIR += --include ./stm32f0xx_conf.h

CC = arm-none-eabi-gcc
AS = arm-none-eabi-as
LD = arm-none-eabi-gcc
AR = arm-none-eabi-ar
OBJCP = arm-none-eabi-objcopy
OBJDUMP = arm-none-eabi-objdump
OBJDUMP = arm-none-eabi-objdump
SIZE = arm-none-eabi-size

CCFLAGS := -D STM32F030 -D USE_STDPERIPH_DRIVER
CCFLAGS += $(CPU_FLAG) -Wall -g '-std=gnu99' -O2 -fno-common
CCFLAGS := -D STM32F030 -D USE_STDPERIPH_DRIVER
CCFLAGS += $(CPU_FLAG) -Wall -g '-std=gnu99' -Os -fno-common -ffunction-sections
CCFLAGS += $(INC_DIR)
ASFLAGS += $(CPU_FLAG) #-Wall

LDFLAGS := -T $(LDSCRIPT) -nostartfiles -Wl,--gc-sections
LDFLAGS += $(CPU_FLAG) -Xlinker -Map=$(PROJECT).map
LDFLAGS := -T $(LDSCRIPT) -nostartfiles -Wl,--gc-sections --specs=nosys.specs
LDFLAGS += $(CPU_FLAG) -Xlinker -Map=$(PROJECT).map

C_OBJS := $(SOURCE:%.c=%.o)
ASM_OBJS := $(SOURCE_ASM:%.s=%.o)
Expand All @@ -44,7 +48,7 @@ COMPILE = $(CC) $(CCFLAGS) -c $< -o $@
ASSEMBLE = $(AS) $(ASFLAGS) -c $< -o $@
LINK = $(LD) $+ $(LDFLAGS) $(LDLIBS) -o $@

.PHONY: all clean printf
.PHONY: all clean

all: $(PROJECT).bin
@echo "build done"
Expand All @@ -53,6 +57,7 @@ $(PROJECT).bin: $(PROJECT).elf
@$(OBJDUMP) -S $(PROJECT).elf > $(PROJECT).list
$(OBJCP) -Oihex $(PROJECT).elf $(PROJECT).hex
$(OBJCP) -Obinary $(PROJECT).elf $(PROJECT).bin
@$(SIZE) --format=Berkeley $(PROJECT).elf

$(PROJECT).elf: $(C_OBJS) $(ASM_OBJS)
@$(LINK)
Expand All @@ -61,7 +66,7 @@ $(C_OBJS):%.o:%.c
@$(COMPILE)

$(ASM_OBJS):%.o:%.s
$(ASSEMBLE)
@$(ASSEMBLE)

clean:
rm -f $(C_OBJS) $(ASM_OBJS)
Expand Down
6 changes: 6 additions & 0 deletions src/app/displed.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include "uart.h"
#include "ush.h"

#define LOG_TAG "led"
#define LOG_LVL LOG_LVL_DBG
#include <ulog.h>

#define CMD_SETBLINK 1 //start which led(s) to blink
#define CMD_SETBLINK_SPEED 2 //set the blink speed
#define CMD_SETCONTRASTA 3 //set the contrast level
Expand Down Expand Up @@ -151,5 +155,7 @@ void displed_init(void){
displed_addfont('v', LEDSEGC|LEDSEGD|LEDSEGE);
displed_addfont('U', LEDSEGA|LEDSEGB|LEDSEGC|LEDSEGD|LEDSEGE);
displed_str("10.123456");
LOG_I("STM8-LED initialized.");
//ulog_i("led", "STM8-LED initialized.");
}
USH_REGISTER(displed_init, ledinit, re-init the led);
1 change: 1 addition & 0 deletions src/app/ulog-noos
Submodule ulog-noos added at c48ccc
16 changes: 0 additions & 16 deletions src/app/ulog/SConscript

This file was deleted.

45 changes: 0 additions & 45 deletions src/app/ulog/backend/console_be.c

This file was deleted.

Loading

0 comments on commit 73a4040

Please sign in to comment.