unable to get the linux headers...

I’m trying to build a linux driver to access the DM timers, and as this is my first attempt at doing so, I’m trying to start out easy and just get a driver hello world example written and I’m having issues with getting the linux headers from apt.

When I run the command:

 sudo apt-get install linux-headers-$(uname -r)

I get the following:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-headers-4.14.108-ti-r144.2
E: Couldn't find any package by glob 'linux-headers-4.14.108-ti-r144.2'
E: Couldn't find any package by regex 'linux-headers-4.14.108-ti-r144.2'

I looked at the rcn.ee repository I found in another support post, and I can’t find the linux headers there either. Do they exist?? Do I need to update my sources.list?

“.2” that was never released… Which means there’s a good chance you built it from source, in which case you have the headers…

There’s an overlay for these timers: https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-PWM-TIMER-P8.07.dts

Regards,

You are correct. I realized my error. I didn’t unpack the fix_linux-headers[…].deb file on my BBB, thank you.

ps, in the older days, cross built “linux-headers*.deb” (armhf target built on x86) didn’t always end up the correct arch for the files inside linux-headers*.deb, i forget when it was eventually fixed… but just a heads up…

Regards,

That is exactly what I’m experiencing! Trying to build my driver is failing because the binaries used are of the incorrect architecture.

Is there any way to rebuild with the correct architecture?

Just build your module on your “x86” machine… You have the cross_complier and set the “KERNEL” directory as what you build against… (the scripts that built linux-image-4.14.108-ti-r144.2 have set all this up…)

Regards,

I will try that. Thank you!

I’ve got my cross-compilation working, but my driver build is failing because the omap_dm_timer* functions can’t be found… apparently I’m missing something, or I’m trying to use the wrong module.

I’m trying to use a DM timer to generate an interrupt at a regular frequency and I thought I found an example of this (DM Timer Beaglebone Black questions - Processors forum - Processors - TI E2E support forums).

I started out just trying to get a minimal driver built (one that does nothing, but does have the general requirements of a driver) and that build’s fine. Next, I tried to add the timer and create an interrupt that will be executed when that timer elapses. I followed the above example. This builds, but gives warnings about missing modules… loading it on the BeagleBone gives these errors:

[78956.154810] iesTimer: Unknown symbol omap_dm_timer_stop (err 0)
[78956.154837] iesTimer: Unknown symbol omap_dm_timer_set_source (err 0)
[78956.154850] iesTimer: Unknown symbol omap_dm_timer_get_fclk (err 0)
[78956.154863] iesTimer: Unknown symbol omap_dm_timer_set_match (err 0)
...

Does anyone have any ideas? I feel like I’m close, but I keep hitting a wall. This is my first attempt at linux driver code, so I’m very much a noob in this domain, sorry for my naivety.

Update

I did find some sourece code for pwm_omap_dmtimer* functions… maybe I should use those?

Update 2

Ooooo, I also just found out via elixir.bootlin.com (dmtimer.h - arch/arm/plat-omap/include/plat/dmtimer.h - Linux source code (v4.14.108) - Bootlin) that there is supposed to be this header that I don’t have (arch/arm/plat-omap/include/plat/dmtimer.h). I’m guessing that there is some config I don’t have enabled in my kernel build…

If anyone thinks I’m going down the wrong path here, let me know.

Depends, how are you planning to use dmtimer? as a normal pwm signal output? or something else…

Regards,

I’m planning on using it generate a periodic interrupt. The interrupt code will perform analog input into a buffer. I’ll use that input buffer in my application code to regulate my output signals.

This is my plan anyway…

Since this driver is in mainline, i’m trying to figure out if what you want to use it for is already supported…

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/timer/ti,timer-dm.yaml?h=v6.6-rc1

I’ve only ever used it as a pwm out on mainline, but loking at ^ there is more functionality…

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clocksource/timer-ti-dm-systimer.c

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clocksource/timer-ti-dm.c

Regards,

Ok, so how do I use it?

I’m already including the clocksource/timer-ti-dm.h header in my code, but when I build my driver I get warnings:


WARNING: "omap_dm_timer_start" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_set_match" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_set_load" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_write_counter" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_enable" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_get_fclk" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_set_int_enable" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_get_irq" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_set_source" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_request_by_node" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_write_status" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_read_status" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_free" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!
WARNING: "omap_dm_timer_stop" [/mnt/c/ies/file/16750/Kernel/my_drivers/timerDriver/iesTimer.ko] undefined!

Do I have to specify linker options or something? This seems like a noob problem…

i’ve only used it as a pwm output… here’s one of hte overlay examples:

Regards,