Closed eunwoo closed 5 years ago
There was some progress after the previous post.
I searched internet. And I found why the make issues error. I edited the Makefile as below.
# If cross compiling from windows use native GNU-Make 4.2.1
# https://sourceforge.net/projects/ezwinports/files/
# download "make-4.2.1-without-guile-w32-bin.zip" and set it on the enviroment path
# There is no need to install cygwin or any of that sort of rubbish
ifeq ($(OS), Windows_NT)
#WINDOWS USE THESE DEFINITIONS
RM = -del /q /f
SLASH = \\
SWALLOW_OUTPUT = >nul 2>nul
else
#LINUX USE THESE DEFINITIONS
RM = -rm -f
SLASH = /
SWALLOW_OUTPUT =
endif
CFLAGS = -Wall -O3 -mcpu=cortex-a53 -mfpu=neon -mfloat-abi=hard -ffreestanding -nostartfiles -std=c11 -mno-unaligned-access -fno-tree-loop-vectorize -fno-tree-slp-vectorize -Wno-nonnull-compare
ARMGNU = D:/gcc-arm/bin/arm-none-eabi
LINKERFILE = rpi32.ld
SMARTSTART = SmartStart32.S
IMGFILE = kernel8-32.img
# The directory in which source files are stored.
SOURCE = ${CURDIR}
BUILD = build
# The name of the assembler listing file to generate.
LIST = kernel.list
# The name of the map file to generate.
MAP = kernel.map
# The names of all object files that must be generated. Deduced from the
# assembly code files in source.
ASMOBJS = $(SOURCE)/$(SMARTSTART)
COBJS = $(patsubst $(SOURCE)/%.c,$(BUILD)/%.o,$(wildcard $(SOURCE)/*.c))
Pi3: kernel.elf
BINARY = $(IMGFILE)
.PHONY: Pi3
$(BUILD)/%.o: $(SOURCE)/%.s
$(ARMGNU)-gcc -MMD -MP -g $(CFLAGS) -c $< -o $@ -lc -lm -lgcc
$(BUILD)/%.o: $(SOURCE)/%.S
$(ARMGNU)-gcc -MMD -MP -g $(CFLAGS) -c $< -o $@ -lc -lm -lgcc
$(BUILD)/%.o: $(SOURCE)/%.c
$(ARMGNU)-gcc -MMD -MP -g $(CFLAGS) -c $< -o $@ -lc -lm -lgcc
kernel.elf: $(ASMOBJS) $(COBJS)
$(ARMGNU)-gcc $(CFLAGS) $(ASMOBJS) $(COBJS) -T $(LINKERFILE) -Wl,--build-id=none -o kernel.elf -lc -lm -lgcc
$(ARMGNU)-objdump -d kernel.elf > $(LIST)
$(ARMGNU)-objcopy kernel.elf -O binary DiskImg/$(BINARY)
$(ARMGNU)-nm -n kernel.elf > $(MAP)
# Control silent mode .... we want silent in clean
.SILENT: clean
# cleanup temp files
clean:
$(RM) $(MAP)
$(RM) kernel.elf
$(RM) $(LIST)
$(RM) $(BUILD)$(SLASH)*.o
$(RM) $(BUILD)$(SLASH)*.d
echo CLEAN COMPLETED
.PHONY: clean
I deleted other targets except one I need, Pi3.
D:\Prog\Raspberry\Raspberry-Pi-master\Raspberry-Pi-master\myBlinker>make Pi3
D:/gcc-arm/bin/arm-none-eabi-gcc -MMD -MP -g -Wall -O3 -mcpu=cortex-a53 -mfpu=neon -mfloat-abi=hard -ffreestanding -nostartfiles -std=c11 -mno-unaligned-access -fno-tree-loop-vectorize -fno-tree-slp-vectorize -Wno-nonnull-compare -c D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/main.c -o build/main.o -lc -lm -lgcc
D:/gcc-arm/bin/arm-none-eabi-gcc -Wall -O3 -mcpu=cortex-a53 -mfpu=neon -mfloat-abi=hard -ffreestanding -nostartfiles -std=c11 -mno-unaligned-access -fno-tree-loop-vectorize -fno-tree-slp-vectorize -Wno-nonnull-compare D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/SmartStart32.S build/rpi-SmartStart.o build/main.o build/emb-stdio.o -T rpi32.ld -Wl,--build-id=none -o kernel.elf -lc -lm -lgcc
D:/gcc-arm/bin/arm-none-eabi-objdump -d kernel.elf > kernel.list
D:/gcc-arm/bin/arm-none-eabi-objcopy kernel.elf -O binary DiskImg/kernel8-32.img
D:/gcc-arm/bin/arm-none-eabi-nm -n kernel.elf > kernel.map
There is some warnings in compiling. Is this the problem?
D:\Prog\Raspberry\Raspberry-Pi-master\Raspberry-Pi-master\myBlinker>make Pi3
D:/gcc-arm/bin/arm-none-eabi-gcc -MMD -MP -g -Wall -O3 -mcpu=cortex-a53 -mfpu=neon -mfloat-abi=hard -ffreestanding -nostartfiles -std=c11 -mno-unaligned-access -fno-tree-loop-vectorize -fno-tree-slp-vectorize -Wno-nonnull-compare -c D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/rpi-SmartStart.c -o build/rpi-SmartStart.o -lc -lm -lgcc
D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/rpi-SmartStart.c: In function 'ClearArea16':
D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/rpi-SmartStart.c:1033:2: warning: 'packed' attribute ignored for type 'RGB565 *' {aka 'struct <anonymous> *'} [-Wattributes]
RGB565* __attribute__((__packed__, aligned(2))) video_wr_ptr = (RGB565*)(uintptr_t)(dc->fb + (y1 * dc->pitch * 2) + (x1 * 2));
^~~~~~
D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/rpi-SmartStart.c: In function 'WriteChar32':
D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/rpi-SmartStart.c:1415:2: warning: 'packed' attribute ignored for type 'RGBA *' {aka 'union <anonymous> *'} [-Wattributes]
RGBA* __attribute__((__packed__, aligned(4))) video_wr_ptr = (RGBA*)(uintptr_t)(dc->fb + (dc->curPos.y * dc->pitch * 4) + (dc->curPos.x * 4));
^~~~
D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/rpi-SmartStart.c: In function 'TransparentWriteChar32':
D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/rpi-SmartStart.c:1437:2: warning: 'packed' attribute ignored for type 'RGBA *' {aka 'union <anonymous> *'} [-Wattributes]
RGBA* __attribute__((__packed__, aligned(4))) video_wr_ptr = (RGBA*)(uintptr_t)(dc->fb + (dc->curPos.y * dc->pitch * 4) + (dc->curPos.x * 4));
^~~~
D:/gcc-arm/bin/arm-none-eabi-gcc -Wall -O3 -mcpu=cortex-a53 -mfpu=neon -mfloat-abi=hard -ffreestanding -nostartfiles -std=c11 -mno-unaligned-access -fno-tree-loop-vectorize -fno-tree-slp-vectorize -Wno-nonnull-compare D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/SmartStart32.S build/rpi-SmartStart.o build/main.o build/emb-stdio.o -T rpi32.ld -Wl,--build-id=none -o kernel.elf -lc -lm -lgcc
D:/gcc-arm/bin/arm-none-eabi-objdump -d kernel.elf > kernel.list
D:/gcc-arm/bin/arm-none-eabi-objcopy kernel.elf -O binary DiskImg/kernel8-32.img
D:/gcc-arm/bin/arm-none-eabi-nm -n kernel.elf > kernel.map
But still, my LCD shows black screen. Can you help me with this?
Thank you.
I will look at compiling issue but can you check with my pre-compiled version and not use a config.txt as it will autodetect size and because I am using basically same screen
This is my screen I am using https://github.com/LdB-ECM/Docs_and_Images/blob/master/Images/20190306_135846.jpg
And it displays correctly (bad image but you get the idea) https://github.com/LdB-ECM/Docs_and_Images/blob/master/Images/20190306_135720.jpg
Thank you for the answer.
I did as what you said. I copies all files in DiskImg to SD card and deleted config.txt. The screen is not showing any figures, just black screen.
the rpi3 and LCD showing black screen https://github.com/eunwoo/rpi3/blob/master/IMG_20190307_071853.jpg
the back side of my LCD https://github.com/eunwoo/rpi3/blob/master/IMG_20190307_071952.jpg
When I tested official raspbian, without config.txt including the additional resolution setting script, the screen shows blurry figures. https://github.com/eunwoo/rpi3/blob/master/raspbian_screen_without_configtxt.jpg https://github.com/eunwoo/rpi3/blob/master/raspbian_screen_with_configtxt.jpg
The added script is from the LCD manual. It says
Step 1, Install Raspbian official image 1) Download the latest RaspbianImage from the official website: https://www.raspberrypi.org/downloads/ 2) Format TF card by SDFormatter 3) Burn the official image into TF card by using Win32DiskImager.
Step 2, modify the “config.txt” After the programming of Step1 is completed, open the config.txt file of TF card root directory and add the following code at the end of the file, save and eject TF card safely: max_usb_current=1 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_cvt 800 480 60 6 0 0 0
As luck would have it I have exactly that screen as a sample from a manufacturer but have never used it, let me look today.
Do you have a serial adapter board for your Pi because it might also be interesting to spit the LCD screen detection details out to see what it sees.
Update: Okay so I had what appear to be exactly same screen as yours it worked fine the only strange thing was it detects as 640x480 although I could change my screen init to
PiConsole_Init(800, 480, 0, printf);
I also had exactly same model Pi board as you and it had no problem.
So I need to ask can you run any of my samples or is it just the GLES that doesn't work?
I don't have USB to RS232 TTL serial cable and ordered. And I will test other samples and let you know the result. Thank you.
Test result is as follows. Only one test, Arm32_64_USB shows text on the LCD.
folder | Result | ||
---|---|---|---|
Screen | Flash Once | Keep Flashing | |
10_virtualmemory | Black | O | |
Arm32_64_USB | Text | O | |
Core3Interrupt | Black | O | |
FreeRTOSv10.1.1 | Black | O | |
GL_GUI_STEP1 | Black | O | |
GLES2 | Black | O | |
GLES2_Model | Black | O | |
GLES2_Rotate | Black | O | |
Multicore | Black | O | |
myBlinker | Black | O | |
PlayGround | Black | O | |
RayCast | Black | O | |
SD_FAT32 | Black | O | |
SimpleSched | Black | O |
The screen in Arm32_64_USB test looks like this. https://github.com/eunwoo/rpi3/blob/master/IMG_20190309_195328.jpg
I recompiled kernel8.img and kernel8-32.img. The file size of both are 58KB. But the size of the original file in your repository is 88KB and 69KB. And when I compiling the kernel8.img, error occurred like below. So, I used the compiler for kernel8-32.img although this must make the wrong image. D:\Prog\Raspberry\Raspberry-Pi-master\Raspberry-Pi-master_test\Arm32_64_USB>make Pi3-64 D:/gcc-linaro-7.4.1/bin/aarch64-elf-gcc -MMD -MP -g -Wall -O3 -mcpu=cortex-a53 -mfpu=neon -mfloat-abi=hard -ffreestanding -nostartfiles -std=c11 -mno-unaligned-access -fno-tree-loop-vectorize -fno-tree-slp-vectorize -Wno-nonnull-compare -c D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master_test/Arm32_64_USB/main.c -o build/main.o -lc -lm -lgcc aarch64-elf-gcc: error: unrecognized command line option '-mfpu=neon' aarch64-elf-gcc: error: unrecognized command line option '-mfloat-abi=hard' aarch64-elf-gcc: error: unrecognized command line option '-mno-unaligned-access'; did you mean '-Wno-aligned-new'? make: *** [Makefile:68: build/main.o] Error 1
Also, I tested in order to know which file is used to be executed. I put only one img file, kernel8.img, LCD shows the text. And for kernel8-32.img, LCD shows nothing. Rpi3 seems to be working in 64-bit mode.
So when your screen works on that one file it goes into 640x480 mode which it does for me as well. What is really weird is the same code on the other samples doesn't turn it on. The only thing about the USB sample is it powers on all the peripherals via the mailbox so I can only assume that is causing the difference but your board is not acting like any I have seen.
Can I ask that you download absolute latest firmware from here https://github.com/raspberrypi/firmware/tree/master/boot So start.elf, bootcode.bin and fixup.dat from there onto your SD card
I will put up a sample with one of the GLES ones but I will power up the peripherals via the mailbox as it is 3 lines of a code and lets see if it turns on your screen.
I will also do a checkup on all the Repository as it seems to have some makefile errors which have drifted in over time as I have changed things.
We private email you soon as it's all done.
Can I ask a question how are you powering the LCD screen ... it wouldn't happen to be via the USB on the Pi?
If that was the case it would make sense the screen only turns on when the USB is powered up !!!!!!! I didn't really think about making samples for screens that drag power from the onboard USB.
For the record I power mine by having a splitter on powerpack so I can power both the screen and board at same time :-)
Finally, I can see the rotating triangle and rectangle on the LCD. Beautiful! I have seen the screen for a long time with joy. The reason is the LCD was not powered up as you said. I used 2 port dc adapter for smartphones. One thing I would like to mention is the raspberry pi and LCD should be powered up by the same adapter, like multi port usb hub or the smartphone adapter I used. When I powered up raspberry pi from one adapter and LCD from another adapter, the LCD was back-lit but showed nothing. I also tested pi with one adapter and LCD with computer's usb port, in this case LCD also showed nothing. And the LCD worked without updating boot files from https://github.com/raspberrypi/firmware/tree/master/boot
Lastly, can you help me compiling the sources? I rebuilt your source, but the size of .img file is not the same as yours in the github.
And the USB to TTL cable arrived home today. I will experiment with it.
Thank you.
The size of image is dependent on compiler because of optimization my original images were compiled on GCC version 6.0. We are now up to GCC 7.4 and they won't be the same size they should be smaller.
As discussed I am going thru updating the repository which is a large task as well as adding a couple more samples so give me a day or two :-)
It would appear you have resolved issue so i will close issue. Please let me know if issue is not resolved.
Thank you for your support and answer.
By the way, do you have a plan to update with compiling issue? When building by makefile using the latest compiler, I see some errors. After fixing makefile and compiling, the screen doesn't display with resulting .img file.
Hello,
First of all, thank you for your material. I'm starting to learn bare metal programming with raspberry pi3. In the board, it is printed as Raspberry Pi 3 Model B V1.2. There's so much to learn. The problem is when building the kernel using make utility, there's error message like this.
D:\Prog\Raspberry\Raspberry-Pi-master\Raspberry-Pi-master\myBlinker>make Pi3-64 make: *** No rule to make target 'D:/Prog/Raspberry/Raspberry-Pi-master/Raspberry-Pi-master/myBlinker/', needed by 'kernel.elf'. Stop.
I'm working on Windows 10 and installed gcc and make. Two GCCs are installed in the following path. And I edited the Makefile to be the same as this.
This is my whole Makefile.
And I tested your GLES2_Rotate? But the LCD shows nothing. LDC is 7-inch touchscreen with resolution 800 x 480. I added the following lines to config.txt. max_usb_current=1 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_cvt 800 480 60 6 0 0 0
I formatted my sd card to FAT32 and put all files in DiskImg to root folder of sd card.
Can you give me some suggestions to fix this?
Thank you.