jameswalmsley / bitthunder

BitThunder - Reliable, real time, portable, scalable, embedded operating system, RTOS.
http://bitthunder.org
Other
170 stars 48 forks source link

Raspberry Pi undeclared 'BT_CONFIG_MACH_BCM2835_SYSCLOCK_FREQ' #43

Closed NeroBurner closed 7 years ago

NeroBurner commented 8 years ago

Following the steps from http://blog.richardweiss.org/2015/06/27/raspberry-pi-bitthunder.html

The first steps go well, but when executing make the follwoing error happens:

make
 Dark Builder
 Version (1.6.0 - BiCEP2 (Gravitational Waves))
  [CONF]   [BitThunder]      /home/nero/repos/pithunder/include/bt_bsp_config.h
  [CC]     [FreeRTOS]        kernel/bt_freertos_if.o
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/croutine.o
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/list.o
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/queue.o
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/tasks.o
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/event_groups.o
  [CC]     [HAL]             arch/arm/mach/bcm2835/bcm2835.o
/home/nero/repos/pithunder/../bitthunder/arch/arm/mach/bcm2835/bcm2835.c: In function 'bcm2835_get_cpu_frequency':
/home/nero/repos/pithunder/../bitthunder/arch/arm/mach/bcm2835/bcm2835.c:89:9: error: 'BT_CONFIG_MACH_BCM2835_SYSCLOCK_FREQ' undeclared (first use in this function)
  return BT_CONFIG_MACH_BCM2835_SYSCLOCK_FREQ;
         ^
/home/nero/repos/pithunder/../bitthunder/arch/arm/mach/bcm2835/bcm2835.c:89:9: note: each undeclared identifier is reported only once for each function it appears in
/home/nero/repos/pithunder/../bitthunder/.dbuild/../.dbuild/c-objects.mk:41: recipe for target '/home/nero/repos/pithunder/build/arch/arm/mach/bcm2835/bcm2835.o' failed
make: *** [/home/nero/repos/pithunder/build/arch/arm/mach/bcm2835/bcm2835.o] Error 1

When manually setting the frequency the following error happens:

make
 Dark Builder
 Version (1.6.0 - BiCEP2 (Gravitational Waves))
  [CC]     [HAL]             arch/arm/mach/bcm2835/bcm2835.o
  [CC]     [HAL]             arch/arm/mach/bcm2835/irq_chip.o
/home/nero/repos/pithunder/../bitthunder/arch/arm/mach/bcm2835/irq_chip.c:22:45: error: 'BT_CONFIG_MACH_BCM2835_TOTAL_IRQ' undeclared here (not in a function)
 static BT_INTERRUPT_VECTOR   g_oVectorTable[BT_CONFIG_MACH_BCM2835_TOTAL_IRQ];
jameswalmsley commented 8 years ago

I'm going to look into this now, did you use the exact commit that Richard used? It should work nicely with the latest release also, 0.9.2 and the latest master. Checking on my pi now.

jameswalmsley commented 8 years ago

Hi @NeroBurner

I did the following: git clone git://github.com/jameswalmsley/bitthunder.git cd bitthunder make menuconfig # Selected BCM2835, and RaspberryPI Model B as the board. make defconfig make -j32

I sucessfully get a vmthunder.img.

Can you please confirm your steps so I can find the problem.

James

NeroBurner commented 8 years ago

Hey, thanks for testing. Your steps are working. But when I try to follow the tutorial from http://blog.richardweiss.org/2015/06/27/raspberry-pi-bitthunder.html it won't compile.

what does the -j32 flag do?

Here are my steps with output:

clone bitthunder

git clone https://github.com/jameswalmsley/bitthunder.git

fix the line in bitthunder/.dbuild/relpath.py for python3 print(os.path.relpath(sys.argv[1], sys.argv[2]))

create a working directory and change into it, creatively called pithunder

mkdir pithunder
cd pithunder/

populate the working directory

make -C ../bitthunder/ PROJECT_DIR=$(pwd) project.init
make: Entering directory '/home/nero/repos/bitthunder'
 ******************************************************
   >>>> No .config file found, run make menuconfig
 ******************************************************
make: Leaving directory '/home/nero/repos/bitthunder'

create .config with menuconfig for Raspberry Pi Model B

System Architecture ->
    CPU Architecture -> ARM
    ARM chip selection -> BCM2835 (Raspberryi Pi)
    BCM2835 Boards - > RaspberryPi Model B

Note: I think ARM chip selection has a typo ;)

make menuconfig
 ******************************************************
   >>>> No .config file found, run make menuconfig
 ******************************************************
touch /home/nero/repos/pithunder/.config
cp /home/nero/repos/pithunder/../bitthunder/.config /home/nero/repos/pithunder/.config.bak
cp: cannot stat ‘/home/nero/repos/pithunder/../bitthunder/.config’: No such file or directory
/home/nero/repos/pithunder/../bitthunder/.dbuild/dbuild.mk:174: recipe for target 'menuconfig' failed
make: [menuconfig] Error 1 (ignored)
cp /home/nero/repos/pithunder/.config /home/nero/repos/pithunder/../bitthunder/.config
cd /home/nero/repos/pithunder/../bitthunder/ && CONFIG_=BT_CONFIG_ PROJECT_DIR=/home/nero/repos/pithunder kconfig-mconf Kconfig
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

make mkconfig
cp /home/nero/repos/pithunder/../bitthunder/.config /home/nero/repos/pithunder/.config
cp /home/nero/repos/pithunder/.config.bak /home/nero/repos/pithunder/../bitthunder/.config
cp: cannot stat ‘/home/nero/repos/pithunder/.config.bak’: No such file or directory
/home/nero/repos/pithunder/../bitthunder/.dbuild/dbuild.mk:174: recipe for target 'menuconfig' failed
make: [menuconfig] Error 1 (ignored)

Then copy the .config

make defconfig
Copying arm/mach/bcm2835/boards/raspberrypi_model_b.defconfig to .config

Then do the compilation (now with your -j32 flag

make -j32                                                                                               
 Dark Builder                                                                                                                        
 Version (1.6.0 - BiCEP2 (Gravitational Waves))                                                                                      
  [CONF]   [BitThunder]      /home/nero/repos/pithunder/include/bt_bsp_config.h                                       
  [CC]     [FreeRTOS]        kernel/bt_freertos_if.o                                                                                 
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/croutine.o                                                                       
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/list.o                                                                           
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/queue.o                                                                          
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/tasks.o                                                                          
  [CC]     [FreeRTOS]        kernel/FreeRTOS/Source/event_groups.o                                                                   
  [CC]     [HAL]             arch/arm/mach/bcm2835/bcm2835.o                                                                         
  [CC]     [HAL]             arch/arm/mach/bcm2835/irq_chip.o                                                                        
  [CC]     [HAL]             arch/arm/mach/bcm2835/gpio.o                                                                            
  [CC]     [HAL]             arch/arm/mach/bcm2835/timer.o                                                                           
  [CC]     [HAL]             arch/arm/mach/bcm2835/uart.o                                                                            
  [AS]     [HAL]             arch/arm/common/freertos-arm11-asm.o                                                                    
  [CC]     [HAL]             arch/arm/common/freertos-arm11.o                                                                        
  [AS]     [HAL]             arch/arm/mm/v7-mmu-asm.o
  [CC]     [HAL]             arch/arm/mm/v7-mmu.o
  [AS]     [HAL]             arch/arm/boot/head.o
/home/nero/repos/pithunder/../bitthunder/arch/arm/common/freertos-arm11.c: In function 'xPortStartScheduler':
/home/nero/repos/pithunder/../bitthunder/arch/arm/common/freertos-arm11.c:337:4: warning: 'return' with no value, in function returning non-void
    return;
    ^
/home/nero/repos/pithunder/../bitthunder/arch/arm/common/freertos-arm11.c:345:4: warning: 'return' with no value, in function returning non-void
    return;
    ^
/home/nero/repos/pithunder/../bitthunder/arch/arm/common/freertos-arm11.c:350:4: warning: 'return' with no value, in function returning non-void
    return;
    ^
  [AS]     [HAL]             arch/arm/common/crtinit.o
  [CC]     [BitThunder]      os/src/syscall/calls/getpid.o
  [AS]     [HAL]             arch/arm/common/cpuinit.o
  [CC]     [BitThunder]      os/src/syscall/calls/yield.o
  [CC]     [BitThunder]      os/src/syscall/calls/open.o
  [CC]     [BitThunder]      os/src/syscall/calls/close.o
  [CC]     [BitThunder]      os/src/syscall/calls/read.o
  [CC]     [BitThunder]      os/src/syscall/calls/write.o
  [CC]     [BitThunder]      os/src/syscall/calls/lseek.o
  [CC]     [BitThunder]      os/src/syscall/calls/klog.o
  [CC]     [BitThunder]      os/src/syscall/calls/sleep.o
  [CC]     [BitThunder]      os/src/syscall/calls/time.o
  [CC]     [BitThunder]      os/src/syscall/calls/gpio.o
  [CC]     [BitThunder]      os/src/time/time.o
  [CC]     [BitThunder]      os/src/interfaces/bt_if_cpu.o
/home/nero/repos/pithunder/../bitthunder/os/src/syscall/calls/time.c: In function 'bt_sys_gettimeofday':
/home/nero/repos/pithunder/../bitthunder/os/src/syscall/calls/time.c:4:9: warning: implicit declaration of function 'bt_gettimeofday' [-Wimplicit-function-declaration]
  return bt_gettimeofday(tv, tz);
         ^
/home/nero/repos/pithunder/../bitthunder/os/src/syscall/calls/time.c: In function 'bt_sys_settimeofday':
/home/nero/repos/pithunder/../bitthunder/os/src/syscall/calls/time.c:8:9: warning: implicit declaration of function 'bt_settimeofday' [-Wimplicit-function-declaration]
  return bt_settimeofday(tv, tz);
         ^
  [CC]     [BitThunder]      os/src/interfaces/bt_if_power.o
  [CC]     [BitThunder]      os/src/interfaces/bt_dev_if_uart.o
  [CC]     [BitThunder]      os/src/lib/string.o
  [CC]     [BitThunder]      os/src/lib/ctype.o
  [CC]     [BitThunder]      os/src/lib/bcd.o
  [CC]     [BitThunder]      os/src/bt_main.o
  [CC]     [BitThunder]      os/src/process/bt_process.o
  [CC]     [BitThunder]      os/src/process/bt_threads.o
  [CC]     [BitThunder]      os/src/interrupts/bt_interrupts.o
  [CC]     [BitThunder]      os/src/process/bt_alive_led.o
  [CC]     [BitThunder]      os/src/gpio/bt_gpio.o
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_threads.c: In function 'bt_thread_cleanup':
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_threads.c:62:2: warning: implicit declaration of function 'bt_process_thread_cleanup' [-Wimplicit-function-declaration]
  bt_process_thread_cleanup(thread->task);
  ^
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_threads.c: In function 'BT_CreateProcessThread':
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_threads.c:86:3: warning: implicit declaration of function 'BT_DetachHandle' [-Wimplicit-function-declaration]
   BT_DetachHandle(hThread);
   ^
  [CC]     [BitThunder]      os/src/module/bt_module_init.o
  [CC]     [BitThunder]      os/src/timers/bt_timers.o
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_alive_led.c: In function 'led_task':
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_alive_led.c:20:22: error: 'BT_CONFIG_ALIVE_LED_GPIO' undeclared (first use in this function)
  BT_GpioSetDirection(BT_CONFIG_ALIVE_LED_GPIO, BT_GPIO_DIR_OUTPUT);
                      ^
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_alive_led.c:20:22: note: each undeclared identifier is reported only once for each function it appears in
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_alive_led.c:35:30: error: 'BT_CONFIG_ALIVE_LED_PERIOD' undeclared (first use in this function)
   BT_kTaskDelayUntil(&ticks, BT_CONFIG_ALIVE_LED_PERIOD);
                              ^
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_alive_led.c: In function 'bt_led_init':
/home/nero/repos/pithunder/../bitthunder/os/src/process/bt_alive_led.c:48:18: error: 'BT_CONFIG_ALIVE_LED_PRIORITY' undeclared (first use in this function)
   .ulPriority  = BT_CONFIG_ALIVE_LED_PRIORITY,
                  ^
  [CC]     [BitThunder]      os/src/process/bt_mutex.o
  [CC]     [BitThunder]      os/src/machines/bt_machines.o
/home/nero/repos/pithunder/../bitthunder/.dbuild/../.dbuild/c-objects.mk:41: recipe for target '/home/nero/repos/pithunder/build/os/src/process/bt_alive_led.o' failed
make: *** [/home/nero/repos/pithunder/build/os/src/process/bt_alive_led.o] Error 1
make: *** Waiting for unfinished jobs....
  [CC]     [BitThunder]      os/src/process/bt_queue.o
/home/nero/repos/pithunder/../bitthunder/os/src/machines/bt_machines.c: In function 'BT_SystemReset':
/home/nero/repos/pithunder/../bitthunder/os/src/machines/bt_machines.c:27:2: warning: implicit declaration of function 'vPortReset' [-Wimplicit-function-declaration]
  vPortReset();
  ^
make: *** wait: No child processes.  Stop.

no image vmthunder.img is created

jameswalmsley commented 8 years ago

@NeroBurner thanks for taking the time to reply. Can you give me the result of:

git rev-parse HEAD

Also attach your .config file, just to make sure we are trying to build the same stuff.

What system are you building on? Ubuntu, or some other platform?

jameswalmsley commented 8 years ago

-j32 on make simply compiles with multiple jobs. It essentially accelerates the compile process. Although -j32 is probably too high.

NeroBurner commented 8 years ago

upload to github somehow not worked, therefore the .config at pastebin http://pastebin.com/RRR2XLX2

git rev-parse HEAD
68b680899910a94f7e9fc4a11b67b9a7745cac23

I'm running archlinux.

uname -r
4.2.2-1-ARCH
python --version
Python 3.5.0

kconfig-frontends installed via self-written pkgbuild

pkgname=kconfig-frontends
pkgver=3.10.rc6
pkgrel=1
arch=('x86_64')
license=('GPL')
source=(git+https://github.com/jameswalmsley/$pkgname.git)
md5sums=('SKIP')

build() {
  cd "$pkgname"

  ./bootstrap
  ./configure --prefix=/usr
  make
}
package() {
  cd "$pkgname"

  make DESTDIR="$pkgdir/" install
}
jameswalmsley commented 8 years ago

@NeroBurner Thanks for the update, I've tested using your .config and I cannot get it to break. I'm using Ubuntu so maybe that is where the problem lies.

Is there an easy way for me to install Arch? Docker or so that you are aware of.. I'll see if I can find a quick docker.

James (p.s. thanks for you patience!)

jameswalmsley commented 8 years ago

@NeroBurner I installed arch linux in a docker, and installed a few packages to get up and running. I get a few more warnings when building like you do, but it compiles with no problems.

I think it has something to do with the config file headers. Check that the bitthunder source folder doesn't have a bt_bsp_config.h file from earlier.

If so delete it and try again.

I have a patch to fix the problem if that is the case.

NeroBurner commented 8 years ago

compiling directly in the folder bitthunder works, but making a new project directory and compile in there does not work.

mkdir pithunder
cd pithunder/
make -C ../bitthunder PROJECT_DIR=$(pwd) project.init

after this step there is nothing in the folder pithunder/include

after make menuconfig there is the file pithunder/include/bt_bsp_config.h

Deleting the file and running defconfig and make still does not compile

rm include/bt_bsp_config.h
make defconfig
make -j32