OrangePiLibra / WiringPi

The WiringPi on OrangePi
GNU Lesser General Public License v3.0
58 stars 29 forks source link

Build OrangePi_H3 failure #2

Open roens opened 7 years ago

roens commented 7 years ago

I've got an Orange Pi Plus H3 board. I've attempted to run build on/for it:

[root@fam:/usr/local/src/WiringPi] # ./build OrangePi_H3
Build WiringPi on OrangePi
./build: 11: [: OrangePi_H3: unexpected operator
wiringPi Build script
=====================

WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] wiringShift.c
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softPwm.c
[Compile] softTone.c
[Compile] softServo.c
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] sn3218.c
[Compile] drcSerial.c
[Compile] RaspberryPi.c
[Compile] OrangePi.c
OrangePi.c: In function ‘readR’:
OrangePi.c:532:14: error: ‘GPIOL_BASE’ undeclared (first use in this function)
  if (addr >= GPIOL_BASE) {
              ^
OrangePi.c:532:14: note: each undeclared identifier is reported only once for each function it appears in
OrangePi.c: In function ‘writeR’:
OrangePi.c:559:14: error: ‘GPIOL_BASE’ undeclared (first use in this function)
  if (addr >= GPIOL_BASE) {
              ^
OrangePi.c: In function ‘OrangePi_set_gpio_mode’:
OrangePi.c:585:13: error: ‘GPIOL_BASE’ undeclared (first use in this function)
   phyaddr = GPIOL_BASE + (bank * 36) + ((index >> 3) << 2);
             ^
OrangePi.c: In function ‘OrangePi_digitalWrite’:
OrangePi.c:670:13: error: ‘GPIOL_BASE’ undeclared (first use in this function)
   phyaddr = GPIOL_BASE + (bank * 36) + 0x10;
             ^
OrangePi.c: In function ‘OrangePi_digitalRead’:
OrangePi.c:759:13: error: ‘GPIOL_BASE’ undeclared (first use in this function)
   phyaddr = GPIOL_BASE + (bank * 36) + 0x10;
             ^
Makefile:131: recipe for target 'OrangePi.o' failed
make: *** [OrangePi.o] Error 1

Make Failed...
Please check the messages and fix any problems. If you're still stuck,
then please email all the output and as many details as you can to
  projects@drogon.net

This is in a freshly cloned repo. I also get the same results after running make clean first.

roens commented 7 years ago

I'm not sure if this helps or causes more trouble, but if I change:

diff --git a/wiringPi/OrangePi.h b/wiringPi/OrangePi.h
index e3bf270..4dc8f92 100644
--- a/wiringPi/OrangePi.h
+++ b/wiringPi/OrangePi.h
@@ -56,6 +56,8 @@
 #define GPIO_NUM                           (0x40)
 #define GPIO_BASE_MAP                      (0x01C20800)
 #define MEM_INFO                           (1024)
+#define GPIOL_BASE                         (0x0)
+#define GPIOL_BASE_MAP                     (0x0)  
 #define MAP_SIZE_L                         (4096 * 2)
 #endif

… then I can get a "successful" build:

[root@fam:/usr/local/src/WiringPi] 26s # ./build OrangePi_H3
Build WiringPi on OrangePi
./build: 11: [: OrangePi_H3: unexpected operator
wiringPi Build script
=====================

WiringPi Library
[UnInstall]
[Compile] OrangePi.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] piNes.c
[Compile] gertboard.c
[Compile] piFace.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

GPIO Utility
[Compile] gpio.c
gpio.c:754:13: warning: ‘doPadDrive’ defined but not used [-Wunused-function]
 static void doPadDrive (int argc, char *argv [])
             ^
gpio.c:842:13: warning: ‘doGbw’ defined but not used [-Wunused-function]
 static void doGbw (int argc, char *argv [])
             ^
gpio.c:884:13: warning: ‘doGbr’ defined but not used [-Wunused-function]
 static void doGbr (int argc, char *argv [])
             ^
gpio.c: In function ‘doLoad’:
gpio.c:217:4: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
    system(cmd);
    ^
gpio.c:223:4: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
    system(cmd);
    ^
gpio.c:254:4: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
    system(cmd);
    ^
gpio.c:259:7: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
       system(cmd);
       ^
[Compile] extensions.c
[Compile] readall.c
[Compile] pins.c
[Compile] OrangePi.c
[Link]
[Install]

All Done.

NOTE: To compile programs with wiringBP v2, you need to add:
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).
konosubakonoakua commented 5 years ago

See this.

/************** OrangePi H3 ***********************/
#if CONFIG_ORANGEPI_H3 || CONFIG_ORANGEPI_H3_ZEROPLUS2
#define GPIOA_BASE                         (0x01C20000)
#define GPIO_NUM                           (0x40)
#define GPIO_BASE_MAP                      (0x01C20800)
#define MEM_INFO                           (1024)
#define GPIOL_BASE                         (0x01F02c00)
#define GPIOL_BASE_MAP                     (0x01F02000)  
#define MAP_SIZE_L                         (4096 * 2)
#define GPIO_PWM_OP                        (0x01C21000)
#endif