-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ssd1306 device driver example #37
base: master
Are you sure you want to change the base?
ssd1306 device driver example #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DevyatovAndrey,
Thank you for sharing the driver.
But could you rebase the branch onto this repo tree?
Because currently it's impossible to diff separate commits via github.
And also if possible -please fix checkpatch issues (at least for the ssd1306, but it make sense for userapp_analog_clock as well):
${BBB_KERNEL}/scripts/checkpatch.pl --file ${TRAINING_REPO}/ssd1306/*.[ch] --terse
ssd1306/Makefile
Outdated
obj-m := ssd1306.o | ||
|
||
KDIR ?= ${HOME}/BBB/bb_kernel/ | ||
#KDIR ?= ~/BBB/KERNEL/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid hardcodding any local path.
And unify expected env. vars with existent mpu6050 driver (see its makefile)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
ssd1306/build_on_x86.sh
Outdated
@@ -0,0 +1,41 @@ | |||
#!/bin/bash -e | |||
|
|||
export CROSS_COMPILE=${HOME}/BBB/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hardcodded export will override anything set in user's environment.
Please avoid committing your paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,415 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use the same baseline version of am335x-bone-common.dtsi as mpu6050 uses? (see ee49cc6)
userapp_analog_clock/Makefile
Outdated
|
||
clean: | ||
rm fb_user | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makefile has very odd view.
Does it work at all?
I believe you meant something like the following
CROSS_COMPILE ?= arm-linux-gnueabihf-
CC = $(CROSS_COMPILE)gcc
CFLAGS = -Wall
.PHONY: all clean
all: analog_clock
analog_clock: analog_clock.c
$(CC) $(CFLAGS) $^ -o $@
clean:
rm analog_clock
@@ -0,0 +1,11 @@ | |||
#!/bin/bash -e | |||
|
|||
export CROSS_COMPILE=${HOME}/BBB/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid using hardcoded absolute paths - use just filename and add its location to $PATH
@@ -0,0 +1,11 @@ | |||
#!/bin/bash -e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you have shell script and makefile same time.
I believe something one is enough (preferably Makefile if you don't have to use some complex shell scripting)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just to have an unified way to build and deploy this application
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So which one is correct?
Now they use different options.
- Either
make
should be called from the shell script and everything have to be defined in the makefile (as it done forssd1306
); - or one of them should be removed to avoid confusion.
2fbf462
to
79f1a87
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DevyatovAndrey,
Thank you for the fixes.
Here some more comments:
ssd1306/ssd1306.c
Outdated
u8 type; | ||
u8 data[LCD_WIDTH * LCD_HEIGHT / 8]; | ||
|
||
u8 data[LCD_WIDTH * LCD_HEIGHT / 8]; | ||
} ssd1306_data_array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ssd1306.c:90: WARNING: do not add new typedefs
ssd1306/ssd1306.c
Outdated
ret = i2c_master_send(drv_client, (u8 *) &dataArray, | ||
sizeof(ssd1306_data_array)); | ||
|
||
if (unlikely(ret < 0)) { | ||
printk(KERN_ERR "i2c_master_send() has returned ERROR %d\n", ret); | ||
return ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use pr_err()
envsetup.sh
Outdated
@@ -4,15 +4,15 @@ export CROSS_COMPILE=${HOME}/BBB/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnuea | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this envsetup.sh
should be published at all.
It will be different for everybody (and don't have to be at all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to set up enviroment variables needed for these examples if there is no "envsetup.sh"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of using environment variables - is exactly to allow to use own environment, which is different for every user (otherwise they should be defined in build scripts instead of passing from environment).
So storing environment settings in VCS doesn't make much sense, because they either will be changed by users and will create a noise in git status or won't be used.
@@ -0,0 +1,11 @@ | |||
#!/bin/bash -e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So which one is correct?
Now they use different options.
- Either
make
should be called from the shell script and everything have to be defined in the makefile (as it done forssd1306
); - or one of them should be removed to avoid confusion.
echo "configure kernel" | ||
make ARCH=arm config | ||
;; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant space line
PWD := $(shell pwd) | ||
|
||
default: | ||
$(MAKE) ARCH=arm -C $(KDIR) M=$(PWD) modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please unify indentation - use single tab
32ee952
to
6d1bb82
Compare
added READMEs
6d1bb82
to
665c191
Compare
I've updated this PR:
|
This adds step by step example of writing kernel device driver for OLED LCD display based on ssd1306 controller.