toastedcpu

Members
  • Content count

    13
  • Joined

  • Last visited

About toastedcpu

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks!!! I made a terrible simplistic mistake. I searched too much in the wrong places. I should have just retyped the whole thing. Frank
  2. Hello @jpeyron, Thanks. I will put together a comprehensive post covering my notes of little changes I needed in all the previous the steps of the tutorial to make work. These are due to packages that were not inside my Ubuntu distro, or changes on where to get certain files. Frank
  3. Hello, I am still working on Embedded Linux Tutorial Zybo http://www.instructables.com/id/Embedded-Linux-Tutorial-Zybo/, and I get a segmentation fault on the C blink code where puts is writing to the /proc/myled. #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(){ FILE *fp; while(1){ printf("open /proc/myled 1\n"); fp = fopen("/proc/myled", "w"); if (fp=NULL){ printf("cannot open /proc/myled for write\b"); return -1; } printf("fputs 0x0F\n"); fputs("0x0F\n", fp); //SEGMENTATION FAULT HAPPENS HERE printf("fclose 1\n"); fclose(fp); sleep(1); In the myled driver I put some printk to see which functions get called. When using the blink.c, the proc_myled_write never even runs. When I interact with the driver without the C code using echo "0x05\n" >> /proc/myled in the terminal, the proc_myled_write runs, there is no segmentation fault and the LEDs change state. zynq> echo "0x05\n" >> /proc/myled proc_myled_open proc_myled_open single_open proc_myled_open end proc_myled_write: 5 Here is the myled.c file: #include <linux/kernel.h> #include <linux/module.h> #include <asm/uaccess.h> /* Needed for copy_from_user */ #include <asm/io.h> /* Needed for IO Read/Write Functions */ #include <linux/proc_fs.h> /* Needed for Proc File System Functions */ #include <linux/seq_file.h> /* Needed for Sequence File Operations */ #include <linux/platform_device.h> /* Needed for Platform Driver Functions */ #include<linux/slab.h> /* Define Driver Name */ #define DRIVER_NAME "myled" unsigned long *base_addr; /* Vitual Base Address */ struct resource *res; /* Device Resource Structure */ unsigned long remap_size; /* Device Memory Size */ /* Write operation for /proc/myled * ----------------------------------- * When user cat a string to /proc/myled file, the string will be stored in * const char __user *buf. This function will copy the string from user * space into kernel space, and change it to an unsigned long value. * It will then write the value to the register of myled controller, * and turn on the corresponding LEDs eventually. */ static ssize_t proc_myled_write(struct file *file, const char __user * buf, size_t count, loff_t * ppos) { char myled_phrase[16]; u32 myled_value; printk(KERN_INFO "proc_myled_write:"); if (count < 11) { if (copy_from_user(myled_phrase, buf, count)) return -EFAULT; myled_phrase[count] = '\0'; } myled_value = simple_strtoul(myled_phrase, NULL, 0); printk(KERN_INFO "%i\n", myled_value); wmb(); iowrite32(myled_value, base_addr); return count; } /* Callback function when opening file /proc/myled * ------------------------------------------------------ * Read the register value of myled controller, print the value to * the sequence file struct seq_file *p. In file open operation for /proc/myled * this callback function will be called first to fill up the seq_file, * and seq_read function will print whatever in seq_file to the terminal. */ static int proc_myled_show(struct seq_file *p, void *v) { printk(KERN_INFO "proc_myled_show\n"); u32 myled_value; printk(KERN_INFO "proc_myled_show ioread32\n"); myled_value = ioread32(base_addr); printk(KERN_INFO "proc_myled_show seq_printf\n"); seq_printf(p, "0x%x", myled_value); return 0; } /* Open function for /proc/myled * ------------------------------------ * When user want to read /proc/myled (i.e. cat /proc/myled), the open function * will be called first. In the open function, a seq_file will be prepared and the * status of myled will be filled into the seq_file by proc_myled_show function. */ static int proc_myled_open(struct inode *inode, struct file *file) { unsigned int size = 16; char *buf; struct seq_file *m; int res; printk(KERN_INFO "proc_myled_open\n"); buf = (char *)kmalloc(size * sizeof(char), GFP_KERNEL); if (!buf) return -ENOMEM; printk(KERN_INFO "proc_myled_open single_open\n"); res = single_open(file, proc_myled_show, NULL); if (!res) { m = file->private_data; m->buf = buf; m->size = size; } else { kfree(buf); } printk(KERN_INFO "proc_myled_open end\n"); return res; } /* File Operations for /proc/myled */ static const struct file_operations proc_myled_operations = { .open = proc_myled_open, .read = seq_read, .write = proc_myled_write, .llseek = seq_lseek, .release = single_release }; /* Shutdown function for myled * ----------------------------------- * Before myled shutdown, turn-off all the leds */ static void myled_shutdown(struct platform_device *pdev) { printk(KERN_INFO "myled_shutdown"); iowrite32(0, base_addr); } /* Remove function for myled * ---------------------------------- * When myled module is removed, turn off all the leds first, * release virtual address and the memory region requested. */ static int myled_remove(struct platform_device *pdev) { printk(KERN_INFO "myled_remove"); myled_shutdown(pdev); /* Remove /proc/myled entry */ remove_proc_entry(DRIVER_NAME, NULL); /* Release mapped virtual address */ iounmap(base_addr); /* Release the region */ release_mem_region(res->start, remap_size); return 0; } /* Device Probe function for myled * ------------------------------------ * Get the resource structure from the information in device tree. * request the memory regioon needed for the controller, and map it into * kernel virtual memory space. Create an entry under /proc file system * and register file operations for that entry. */ static int myled_probe(struct platform_device *pdev) { printk(KERN_INFO "myled_probe\n"); struct proc_dir_entry *myled_proc_entry; int ret = 0; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(&pdev->dev, "No memory resource\n"); return -ENODEV; } printk(KERN_INFO "myled_probe res->star 0x%08lxt\n", res->start ); remap_size = res->end - res->start + 1; if (!request_mem_region(res->start, remap_size, pdev->name)) { dev_err(&pdev->dev, "Cannot request IO\n"); return -ENXIO; } base_addr = ioremap(res->start, remap_size); if (base_addr == NULL) { dev_err(&pdev->dev, "Couldn't ioremap memory at 0x%08lx\n", (unsigned long)res->start); ret = -ENOMEM; goto err_release_region; } myled_proc_entry = proc_create(DRIVER_NAME, 0, NULL, &proc_myled_operations); if (myled_proc_entry == NULL) { dev_err(&pdev->dev, "Couldn't create proc entry\n"); ret = -ENOMEM; goto err_create_proc_entry; } printk(KERN_INFO DRIVER_NAME " probed at VA 0x%08lx\n", (unsigned long) base_addr); return 0; err_create_proc_entry: iounmap(base_addr); err_release_region: release_mem_region(res->start, remap_size); return ret; } /* device match table to match with device node in device tree */ static const struct of_device_id myled_of_match[] = { {.compatible = "dglnt_myled-1.00.a"}, {}, }; MODULE_DEVICE_TABLE(of, myled_of_match); /* platform driver structure for myled driver */ static struct platform_driver myled_driver = { .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, .of_match_table = myled_of_match}, .probe = myled_probe, .remove = myled_remove, .shutdown = myled_shutdown }; /* Register myled platform driver */ module_platform_driver(myled_driver); /* Module Informations */ MODULE_AUTHOR("Digilent, Inc."); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION(DRIVER_NAME ": MYLED driver (Simple Version)"); MODULE_ALIAS(DRIVER_NAME); Any ideas? Thanks, Frank
  4. toastedcpu

    zybo won't boot on sd card FSBL LED D4 (LD_MIO)

    Hello, Thanks for the response! > This is handled entirely in the device tree, and you can tell if one of your designs is doing this by searching the dts and dtsi files for a gpio-leds node (or reverse compiling the dtb Very cool. The problem was that I made two tutorials and got mixed up in the directories. I was putting a compiled FSBL for the Zedboard into a Zybo, so I put the FSBL elf into the BIN. At one point, I got a warning of the FPGA mismatch when I put the debug flag and tried to run the FSBL from the SDK. There is a difference in a clock frequency, so when I did try to see what would happen when stepping the code in SDK with the mismatch, the serial terminal was getting garbage characters because the baud rate was wrong. I got it to boot and run with the Easybox ramdisk, I am nearing the end. Frank
  5. Hello, On the ZYBO, does the green LD4 (LED_MIO) play a role at boot up? While working on http://www.instructables.com/id/Embedded-Linux-Tutorial-Zybo/, I made two BOOT.BINs. One of them boots the SD card properly, so I get the green DONE LD10 lit up with serial terminal activity. The other BOOT.BIN will not light up the green DONE and the LD4 (LED_MIO) goes on. Also, what could be wrong in my BOOT.BIN? I did the FSBL.elf (bootloader partition), system.bit(data file) and u-boot.elf(data file) in the order of the tutorial. Frank
  6. I finished step 36. On this forum, mffrac downloaded a pre-built ramdisk8m.image.gz file over at: https://reference.digilentinc.com/_media/ramdisk8m.image.gz According to this page http://manpages.ubuntu.com/manpages/trusty/man1/mkimage.1.html, it says to use -C instead of -c to specify to compression type. I still don't completely know how much functionality I will get with only a ramdisk. Frank
  7. Hello, I did PATH=$PATH:~/u-boot-Digilent-Dev/tools/ and now I am stuck at step 36 Make Uramdisk http://www.instructables.com/id/Embedded-Linux-Tutorial-Zybo/. Please help. knarf@knarf-VirtualBox:~$ ./u-boot-Digilent-Dev/tools/mkimage -A arm -T ramdisk -c gzip -d ./ramdisk8M.image.gz uramdisk.image.gz ./u-boot-Digilent-Dev/tools/mkimage: Can't open ./ramdisk8M.image.gz: No such file or directory It created a uramdisk.image.gz file of 64 bytes. I didn't make a Tutorial directory, so I work in my home directory. The previous step compiled the kernel and put the kernel images in /home/knarf/Linux-Digilent-Dev/arch/arm/boot/. Also, if I use a ramdisk, that means I don't use a filesystem like Linaro. Wouldn't most of the usual Linux directories be missing? (First, I just wan't to finish the tutorial, later I would redo it with Linaro.) Frank
  8. toastedcpu

    Linux on Zybo made with Windows Vivado+SDK, Ubuntu VM

    Cool, thanks to both of you. I installed Vivado 2015.4 for Linux. I am more advanced in the steps now. When I wrote: make CROSS_COMPILE=arm-xilinx-gnueabi-zynq_zybo_config This is wrong. It was missing a space. It should be changed to make CROSS_COMPILE=arm-xilinx-gnueabi- zynq_zybo_config I saw in a downloaded older PDF of the instructables article ZYBO written with capitals. This was corrected in the instructables article. I had to do install for Ubuntu 14.04 sudo apt-get install lib32z1 lib32ncuses5 lib32bz2-1.0 because even after `source /opt/Xilinx/Vivado/2015.4/settings.sh`, it was complaining about files not found.
  9. Hello, I have Windows machine with Vivado2017.2 and SDK installed, also I got VirtualBox Ubuntu 14.04. I am not set up properly to do Digilent's tutorial by K Franz at http://www.instructables.com/id/Embedded-Linux-Tutorial-Zybo/ because it assumes Vivado and SDK installed on Linux. At step 20, when I download https://github.com/Digilent/u-boot-Digilent-Dev.git, and compile at step 21, the Ubuntu installation has no Xilinx tools inside it. knarf@knarf-VirtualBox:~/Documents/digilent-u-boot.git$ make CROSS_COMPILE=arm-xilinx-gnueabi-zynq_zybo_config System not configured - see README make: *** [all] Error 1 knarf@knarf-VirtualBox:~/Documents/digilent-u-boot.git$ What is the easiest way to fix my setup? Can I download something much smaller than the full sized Vivado and SDK? Would this work https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html Xilinx_SDK_2018.1_0405_1_Lin64.bin ? It has three install options XSDK, XSCT and BootGen. It is over 10GB for the first two choices. My main goal is to be able to write code in Linux that reads and writes to registers of PL IP I design. Frank
  10. Hello, Is there a real simple demo of the wishbone bus with a simple compatible soft CPU or AXI bridge, to just write to leds and read from switches? The target would be the for arty, zybo. Frank
  11. Hello, I downloaded this neat Hamsterworks VHDL example for Ethernet. https://github.com/hamsternz/FPGA_GigabitTx On byte_data.vhd, there is a mismatch on line 52 between the ip_src_addr hex value and comment. The hex value should be C0A80140 to get 192.168.1.64. The hex value C0A40140 in the code gives 192.164.1.64. Frank