X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Message-ID: <51DEFB77.8090905@sonic.net> Date: Thu, 11 Jul 2013 11:37:43 -0700 From: Dave Curtis User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: geda-user AT delorie DOT com Subject: Re: [geda-user] Help storing a 7KB wave file into memory References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------020609030300080601090008" Reply-To: geda-user AT delorie DOT com This is a multi-part message in MIME format. --------------020609030300080601090008 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 07/11/2013 10:15 AM, Rob Butts wrote: > All good questions! > > I'm not sure how I'm going to read that file into memory. At this > point I'd like to see what is in it and thought it might help me > figure out how to read it into memory. > > I'll be using a microchip micro. I've never done anything like this > so I'm just trying to figure it out. What you have is a binary data file that you want to flash into the microprocessor somehow, in such a way that your program can find it. I know how to do this for AVR's... but don't use Microchip processors, so you'll need to find the equivalent. You have two issues to solve: 1) get the binary data into a format that can be incorporated into the binary image of your program, at which point the programmer should be happy to stuff it into the chip. 2) make the address of the binary data available to your program as a pointer. With AVR's, you would typically put just enough linkage dictionary around the binary blob to create a data section (using a simple tool). This becomes just another .o into the linker. The C program makes an external reference to the beginning of the data section to set a pointer. Drop the whole works into the linker so that it can sew together the external references, and from there on its just the normal flow for flashing an image. BTW -- Now would be a good time to take a quick peek at how many bytes your audio file is, and how much flash space you have in your microcontroller. -dave > > > On Thu, Jul 11, 2013 at 12:37 PM, Gareth Edwards > > wrote: > > On 11 July 2013 17:17, Rob Butts > wrote: > > That gave me a .raw file but I can't open it to see the data and > if I double > > click on the file I get an Open With window suggesting a slew of > > applications. > > > > The bytes of that file are the bytes of the audio data. Why do you > need to see them? (hexl-mode in Emacs or any other hex editor will let > you if you really think you need to) > > You said you were going to "store it in memory on a board and then > DtoA it to a speaker when needed." - how do you intend to get it into > the board memory? > > --------------020609030300080601090008 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
On 07/11/2013 10:15 AM, Rob Butts wrote:
All good questions!

I'm not sure how I'm going to read that file into memory.  At this point I'd like to see what is in it and thought it might help me figure out how to read it into memory.

I'll be using a microchip micro.  I've never done anything like this so I'm just trying to figure it out.
What you have is a binary data file that you want to flash into the microprocessor somehow, in such a way that your program can find it. I know how to do this for AVR's... but don't use Microchip processors, so you'll need to find the equivalent.

You have two issues to solve:

1) get the binary data into a format that can be incorporated into the binary image of your program, at which point the programmer should be happy to stuff it into the chip.

2) make the address of the binary data available to your program as a pointer.

With AVR's, you would typically put just enough linkage dictionary around the binary blob to create a data section (using a simple tool). This becomes just another .o into the linker.  The C program makes an external reference to the beginning of the data section to set a pointer.  Drop the whole works into the linker so that it can sew together the external references, and from there on its just the normal flow for flashing an image.

BTW -- Now would be a good time to take a quick peek at how many bytes your audio file is, and how much flash space you have in your microcontroller.

-dave

 


On Thu, Jul 11, 2013 at 12:37 PM, Gareth Edwards <gareth AT edwardsfamily DOT org DOT uk> wrote:
On 11 July 2013 17:17, Rob Butts <r DOT butts2 AT gmail DOT com> wrote:
> That gave me a .raw file but I can't open it to see the data and if I double
> click on the file I get an Open With window suggesting a slew of
> applications.
>

The bytes of that file are the bytes of the audio data. Why do you
need to see them? (hexl-mode in Emacs or any other hex editor will let
you if you really think you need to)

You said you were going to "store it in memory on a board and then
DtoA it to a speaker when needed." - how do you intend to get it into
the board memory?


--------------020609030300080601090008--