Go to advanced search

by hldswrth
Tue Mar 11, 2014 12:07 pm
Forum: Bare metal, Assembly language
Topic: memset performance
Replies: 15
Views: 5758

Re: memset performance

Thanks for that. Mostly my settings are already the same as yours. Specific differences I see in my code vs. yours: I have two additional control register updates in my VMM setup, to restrict cache size to 16K and to indicate always use TTBR0. I set domain 0 to client rather than master; I set cachi...
by hldswrth
Tue Mar 04, 2014 2:22 pm
Forum: Bare metal, Assembly language
Topic: memset performance
Replies: 15
Views: 5758

Re: memset performance

Thanks for the suggestions so far.
One other thing to check - I'm setting the TTRB0 address to table address | 0x00000003 (shared/cacheable). Any difference to what you are doing?
by hldswrth
Mon Mar 03, 2014 2:13 pm
Forum: Bare metal, Assembly language
Topic: memset performance
Replies: 15
Views: 5758

Re: memset performance

Colin, With regard to TTRB attributes, "device" only makes sense for memory-mapped registers, correct? In which case I don't see that being relevant to a memset function which is likely never to be used on memory-mapped registers. GPU memory might want different caching attributes to regular memory ...
by hldswrth
Sun Mar 02, 2014 1:30 am
Forum: Bare metal, Assembly language
Topic: memset performance
Replies: 15
Views: 5758

Re: memset performance

My memset is in assembler. It uses at most one of each of store byte, halfword, word, 2 words, 4 words to get to a 32-byte boundary and then writes 8 words at a time (and then one of each of the above as necessary if any bytes left over). MMU, data and instruction cache and branch prediction are all...
by hldswrth
Mon Feb 24, 2014 7:39 pm
Forum: Bare metal, Assembly language
Topic: memset performance
Replies: 15
Views: 5758

Re: memset performance

Thanks for the response. I'll try a hardcoded memory address for loading the program to begin with and then move it around to see how that affects the performance. Right now program code alignment is only at a 16 byte boundary in my O/S (I allocate the code memory off a heap). When I've got proper m...
by hldswrth
Mon Feb 24, 2014 5:36 pm
Forum: Bare metal, Assembly language
Topic: memset performance
Replies: 15
Views: 5758

memset performance

Following some discussion in an earlier thread at http://www.raspberrypi.org/phpBB3/viewtopic.php?f=72&t=65573 , I thought I would try to optimise my memset and memcpy routines in my bare metal OS. These are used in display handling and file/program loading so I thought this would be worthwhile. For...
by hldswrth
Sun Feb 09, 2014 8:01 pm
Forum: Bare metal, Assembly language
Topic: Interrupt vectors
Replies: 6
Views: 3734

Re: Interrupt vectors

Take care with memory register addresses:

Code: Select all

*0x7E00B20C = 192 
The 0x7E000000 addresses are those seen by the VideoCore GPU. The corresponding addresses from the ARM are 0x20000000 - 0x20FFFFFF. So you should be setting *0x2000B20C.
by hldswrth
Fri Jan 31, 2014 10:26 am
Forum: Bare metal, Assembly language
Topic: Mailbox base address?
Replies: 4
Views: 2492

Re: Mailbox base address?

Well when you are using the mailbox you are multi-processing - the ARM and VideoCore running in parallel. ARM docs say you need a DMB between acquiring a resource, for example through locking a mutex or decrementing a semaphore, and making any access to that resource or before making a resource avai...
by hldswrth
Thu Jan 30, 2014 11:12 am
Forum: Bare metal, Assembly language
Topic: Mailbox base address?
Replies: 4
Views: 2492

Re: Mailbox base address?

I was going to point you at the broadcom document linked in the forum sticky post, or at the firmware wiki page however neither appear to describe the mailbox base address. Without a specific reference I guess you just accept that that is the address in memory that is mapped to the first mailbox reg...
by hldswrth
Fri Jan 24, 2014 2:36 pm
Forum: General discussion
Topic: Adding more RAM - presumably impossible?
Replies: 84
Views: 26558

Re: Adding more RAM - presumably impossible?

...continuing the necro...

Another limiting factor may be that I/O devices are mapped in memory at the 512MB mark, meaning either changing that address (and breaking all existing OS's) or having the RAM address space be non-contiguous.
by hldswrth
Fri Jan 24, 2014 2:23 pm
Forum: Bare metal, Assembly language
Topic: SD Card Present Pin
Replies: 5
Views: 1497

Re: SD Card Present Pin

In my SD card initialization routine I do the following: #define GPIO_CD 47 #define GPIO_FUNC_INPUT 0b000 #define GPIO_PULL_UP 2 // set appropriate bits in GPFSEL0/1 gpioSetFunction(GPIO_CD,GPIO_FUNC_INPUT); // set GPPUD to pull value, waits 150 cycles, sets pin in GPPUDCLK0/1, wait 150 cycles, clea...
by hldswrth
Tue Jan 21, 2014 11:16 pm
Forum: Bare metal, Assembly language
Topic: Getting MMU configured (so that D-cache works)
Replies: 7
Views: 3654

Re: Getting MMU configured (so that D-cache works)

Thanks for the response. I have my MMU switched on now, with some bugs ironed out thanks to the code above ;) One gotcha for me - the framebuffer address returned from the mailbox interface has bit 30 set. This meant that when I only mapped 512MB RAM and 16MB I/O I got data access exception from the...
by hldswrth
Tue Jan 21, 2014 12:19 pm
Forum: Bare metal, Assembly language
Topic: Getting MMU configured (so that D-cache works)
Replies: 7
Views: 3654

Re: Getting MMU configured (so that D-cache works)

Just about to turn on my own MMU, and had a question about the quoted code, in particular the Control Register settings. The code states: mode |= 0x0480180D; asm volatile ("mcr p15,0,%0,c1,c0,0" :: "r" (mode) : "memory"); My understanding of the those bit values in the control register is (from the ...
by hldswrth
Thu Dec 26, 2013 8:57 pm
Forum: Bare metal, Assembly language
Topic: Simple assembler question
Replies: 13
Views: 5185

Re: Simple assembler question

I use Eclipse for development in general, along with the C development tools and Yagarto for cross-compiling to ARM. Includes a full editor/syntax highlighter for C and assembler.
by hldswrth
Tue Nov 19, 2013 12:26 pm
Forum: Bare metal, Assembly language
Topic: problem with malloc function
Replies: 12
Views: 4174

Re: problem with malloc function

Are you using CSUD USB driver for the keyboard? There are known issues with that because of incorrect dma buffer sizes which result in seemingly random memory addresses getting overwritten - see http://www.raspberrypi.org/phpBB3/viewtopic.php?f=72&t=54965 The particular addresses I saw corrupted wer...
by hldswrth
Thu Nov 14, 2013 12:15 pm
Forum: Off topic discussion
Topic: when to use lower-case or upper-case & code practice
Replies: 74
Views: 13953

Re: when to use lower-case or upper-case & code practice

I tend to use camel case as that's predominantly used in Java development, however it results in some poor choices, in particular where a name includes an abbreviation. Would you use "initUSBHub" or "initUsbHub"?. The latter looks unnatural but the former also does not look great. In snake case woul...
by hldswrth
Tue Oct 29, 2013 10:03 am
Forum: Bare metal, Assembly language
Topic: SD/MMC and SPI
Replies: 10
Views: 10757

Re: SD/MMC and SPI

I think we're getting pretty confused here with terminology. The interface that the Pi hardware provides to interact with SD cards of whatever type plugged into the SD card slot is documented in chapter 5 of the "BCM2835 ARM Peripherals" document, "External Mass Media Controller". That's what I and ...
by hldswrth
Mon Oct 28, 2013 2:51 pm
Forum: Bare metal, Assembly language
Topic: SD/MMC and SPI
Replies: 10
Views: 10757

Re: SD/MMC and SPI

I never managed to get EMMC working in SPI mode, and spent quite a while distracted by the differences between SPI and non-SPI mode. I could paste my working code here but not sure how much it would help. I used the following document to understand the sequence of commands needed to initialize the S...
by hldswrth
Mon Sep 30, 2013 1:35 pm
Forum: Bare metal, Assembly language
Topic: Another CSUD issue
Replies: 5
Views: 1516

Re: Another CSUD issue

Just checking you applied the fix for the FIFO sizes to set them all to 1024?
I've not had time to test it out fully but that did sort out my issue of seemingly random memory overwrites.
by hldswrth
Mon Sep 16, 2013 5:43 pm
Forum: Bare metal, Assembly language
Topic: CSUD writes to 000f0000 and 00050070
Replies: 11
Views: 4441

Re: CSUD writes to 000f0000 and 00050070

I've tried reducing the size of the FIFOs in CSUD by defining the sizes all as 1024 as suggested, and so far (fingers crossed) have not seen those locations modified nor any other corruption happening. According to the Hardware register, the total FIFO depth is 4080 so setting 3 FIFOs to 1024 bytes ...
by hldswrth
Mon Sep 09, 2013 12:43 pm
Forum: Bare metal, Assembly language
Topic: arm-none-eabi-ld.exe: region `ram' overflowed
Replies: 4
Views: 1540

Re: arm-none-eabi-ld.exe: region `ram' overflowed

Here's what I use for my kernel: SECTIONS { .text 0x8000 : { *start.o(.text) *(.text*) } .bss : { *(.bss) } .data : { *(.data) } . = ALIGN(8); kernel_end = .; /* Identify the end of the kernel in memory. */ } I define the kernel_end symbol so I know where free memory starts for allocating the heap.
by hldswrth
Sun Sep 08, 2013 10:58 pm
Forum: Bare metal, Assembly language
Topic: Mailbox set power problem
Replies: 5
Views: 1506

Re: Mailbox set power problem

Really don't know about the power issue, however the initial state is to have the SD host controller powered on, why would you want to power it off? The property interface doc says (my added "buffer[x]"): Tag format: buffer[2] u32: tag identifier buffer[3] u32: value buffer size in bytes buffer[4] u...
by hldswrth
Sun Sep 08, 2013 8:26 pm
Forum: Bare metal, Assembly language
Topic: Mailbox set power problem
Replies: 5
Views: 1506

Re: Mailbox set power problem

Buffer[4] has the response bit set on the response, that's why you are seeing 0x80000008 in that value. The power state value of 1 indicates that the power ID exists and that it is on - bit 1 indicates the ID does not exist, in which case your return value would be 2, not 1. So it looks like the req...
by hldswrth
Sun Sep 08, 2013 6:26 pm
Forum: Bare metal, Assembly language
Topic: CSUD writes to 000f0000 and 00050070
Replies: 11
Views: 4441

Re: Crash when dynamically loading CSUD

I tried the firmware you referred to and it does stop the reset errors. However I'm still suffering from a timeout fairly soon after starting. It looks like its my issue with memory corruption happening - if I force the keyboard module to be loaded much higher in memory I don't see any errors. Thank...
by hldswrth
Sat Sep 07, 2013 2:28 pm
Forum: Bare metal, Assembly language
Topic: CSUD writes to 000f0000 and 00050070
Replies: 11
Views: 4441

CSUD writes to 000f0000 and 00050070

I've been happily working on a bare metal project for a year on and off, using CSUD for the keyboard, for which I'm very grateful. However a couple of weeks ago all that stopped. I decided to modularise my kernel, and as part of that I moved the CSUD library from being statically linked to the kerne...

Go to advanced search