From d183e029079cfd9a12fe623e730bb8ea99278b23 Mon Sep 17 00:00:00 2001 From: Jochen Keil <1392715+jchnkl@users.noreply.github.com> Date: Wed, 5 May 2021 13:03:06 +0200 Subject: [PATCH] Disable DEBUG messages and enable optimizations --- RaspberryPi_JetsonNano/c/Makefile | 5 +--- .../c/lib/Config/DEV_Config.c | 30 +++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/RaspberryPi_JetsonNano/c/Makefile b/RaspberryPi_JetsonNano/c/Makefile index df7a6fe..f4a771c 100644 --- a/RaspberryPi_JetsonNano/c/Makefile +++ b/RaspberryPi_JetsonNano/c/Makefile @@ -10,9 +10,6 @@ OBJ_O = $(patsubst %.c,${DIR_BIN}/%.o,$(notdir ${OBJ_C})) RPI_DEV_C = $(wildcard $(DIR_BIN)/dev_hardware_SPI.o $(DIR_BIN)/RPI_sysfs_gpio.o $(DIR_BIN)/DEV_Config.o ) JETSON_DEV_C = $(wildcard $(DIR_BIN)/sysfs_software_spi.o $(DIR_BIN)/sysfs_gpio.o $(DIR_BIN)/DEV_Config.o ) - -DEBUG = -D DEBUG - # USELIB_RPI = USE_BCM2835_LIB USELIB_RPI = USE_WIRINGPI_LIB # USELIB_RPI = USE_DEV_LIB @@ -43,7 +40,7 @@ JETSON: JETSON_DEV JETSON_epd TARGET = epd CC = gcc -MSG = -g -O -ffunction-sections -fdata-sections -Wall +MSG = -g -O3 -ffunction-sections -fdata-sections -Wall CFLAGS += $(MSG) RPI_epd:${OBJ_O} diff --git a/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c b/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c index 4b97205..d92c063 100644 --- a/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c +++ b/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c @@ -206,7 +206,7 @@ static int DEV_Equipment_Testing(void) int fd; char value_str[20]; fd = open("/etc/issue", O_RDONLY); - printf("Current environment: "); + Debug("Current environment: "); while(1) { if (fd < 0) { Debug( "Read failed Pin\n"); @@ -218,21 +218,21 @@ static int DEV_Equipment_Testing(void) return -1; } if(value_str[i] ==32) { - printf("\r\n"); + Debug("\r\n"); break; } - printf("%c",value_str[i]); + Debug("%c",value_str[i]); } break; } #ifdef RPI if(i<5) { - printf("Unrecognizable\r\n"); + Debug("Unrecognizable\r\n"); } else { char RPI_System[10] = {"Raspbian"}; for(i=0; i<6; i++) { if(RPI_System[i]!= value_str[i]) { - printf("Please make JETSON !!!!!!!!!!\r\n"); + Debug("Please make JETSON !!!!!!!!!!\r\n"); return -1; } } @@ -245,7 +245,7 @@ static int DEV_Equipment_Testing(void) char JETSON_System[10]= {"Ubuntu"}; for(i=0; i<6; i++) { if(JETSON_System[i]!= value_str[i] ) { - printf("Please make RPI !!!!!!!!!!\r\n"); + Debug("Please make RPI !!!!!!!!!!\r\n"); return -1; } } @@ -284,17 +284,17 @@ Info: ******************************************************************************/ UBYTE DEV_Module_Init(void) { - printf("/***********************************/ \r\n"); + Debug("/***********************************/ \r\n"); if(DEV_Equipment_Testing() < 0) { return 1; } #ifdef RPI #ifdef USE_BCM2835_LIB if(!bcm2835_init()) { - printf("bcm2835 init failed !!! \r\n"); + Debug("bcm2835 init failed !!! \r\n"); return 1; } else { - printf("bcm2835 init success !!! \r\n"); + Debug("bcm2835 init success !!! \r\n"); } // GPIO Config @@ -310,10 +310,10 @@ UBYTE DEV_Module_Init(void) #elif USE_WIRINGPI_LIB //if(wiringPiSetup() < 0)//use wiringpi Pin number table if(wiringPiSetupGpio() < 0) { //use BCM2835 Pin number table - printf("set wiringPi lib failed !!! \r\n"); + Debug("set wiringPi lib failed !!! \r\n"); return 1; } else { - printf("set wiringPi lib success !!! \r\n"); + Debug("set wiringPi lib success !!! \r\n"); } // GPIO Config @@ -321,7 +321,7 @@ UBYTE DEV_Module_Init(void) wiringPiSPISetup(0,10000000); // wiringPiSPISetupMode(0, 32000000, 0); #elif USE_DEV_LIB - printf("Write and read /dev/spidev0.0 \r\n"); + Debug("Write and read /dev/spidev0.0 \r\n"); DEV_GPIO_Init(); DEV_HARDWARE_SPI_begin("/dev/spidev0.0"); DEV_HARDWARE_SPI_setSpeed(10000000); @@ -330,19 +330,19 @@ UBYTE DEV_Module_Init(void) #elif JETSON #ifdef USE_DEV_LIB DEV_GPIO_Init(); - printf("Software spi\r\n"); + Debug("Software spi\r\n"); SYSFS_software_spi_begin(); SYSFS_software_spi_setBitOrder(SOFTWARE_SPI_MSBFIRST); SYSFS_software_spi_setDataMode(SOFTWARE_SPI_Mode0); SYSFS_software_spi_setClockDivider(SOFTWARE_SPI_CLOCK_DIV4); #elif USE_HARDWARE_LIB - printf("Write and read /dev/spidev0.0 \r\n"); + Debug("Write and read /dev/spidev0.0 \r\n"); DEV_GPIO_Init(); DEV_HARDWARE_SPI_begin("/dev/spidev0.0"); #endif #endif - printf("/***********************************/ \r\n"); + Debug("/***********************************/ \r\n"); return 0; }