Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread Koenraad Lelong

On 08-06-12 14:37, Jeppe Græsdal Johansen wrote:

Den 08-06-2012 14:28, Ludo Brands skrev:

Thanks Ludo,

I'll take that as a starting point. I hope I will not need the "lost"
256 bytes in the future.

I could be wrong but AFAIK if the compiler would do the alignment, the
loss
can also be up to 255 bytes. Here you lose 256 bytes in all cases.

Yes, but this would allow the linker to place other stuff there which
fits in less than 255 bytes.

Wasting 255 bytes is a lot on systems that only has a few kilobytes of
RAM. I wonder if the restriction of 32 bytes on the align directive
could just be removed, or will we need some sort of linker script changes?


Hi,

I'm still struggling to get interrupts (or even inputs) work but I 
wanted to comment on the size of the table. Reading the manuals I found 
it's actually on a 512 byte boundery. The VTOR (Vector Table Offset 
Register) masks off the last 9 bits (8..0).
If I need that space I will modify the start of RAM location and use the 
first bytes of RAM for the vector-table.
It would be nice to have "external" linker scripts. That way you could 
more easily add processors, or use custom bootloaders.


Regards,

Koenraad Lelong.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE : RE : [fpc-pascal] Re: Playing sounds with standard components

2012-06-12 Thread Ludo Brands
> Where do I find the openal_nt unit?
> 
> unit1.pas(9,3) Fatal: Can not find unit openal_nt used by Unit1.
> 

At the bottom of the forum page is a link to a complete demo project
openaltest.zip that includes the units laz_openal and OpenAL_NT.

Ludo

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread alrieckert
Hi Jeppe,

I've been using the actual ROM based interrupt table for the past month now
in freepascal ad it seems to work great. No need to declare a block of RAM
and pointing the interrupt table to it.

You can code any procedure and just give it the interrupt keyword with an
address index.

For example:



There are 3 patches you need to apply to your compiler. I'll try to submit
the patches to the Freepascal mailing list and hopefully someone will accept
them, but in the mean time you can find them here.

https://github.com/alrieckert/freepascal/commit/8255677c9a79dfec22b65c5b34be43b1602c6928
https://github.com/alrieckert/freepascal/commit/2e40029a9d4b191ee06b7b3519bdc382769adbc7
https://github.com/alrieckert/freepascal/commit/1883b86791af851f0c5093760e349dc8854c5905

The first patch enables the interrupt keyword for the arm-embedded target
and allows the compiler to generate the NVIT table that will link in at
0x08000

The second patch is a small bug fix with the stm32f103.pp definition file

The third patch fixed the exit code, otherwise you will get Hard Fault
interrupt when a interrupt occurs as a procedure is busy restoring the stack
and SP.

No need to give the nostackframe since the ARMv7m automatically stores
R0-R3, R12, SP and LR for you when  an interrupt occurs, thus the interrupt
procedure looks exactly like a normal procedure.

Please let me know if you have any questions.

--
Anton  

--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Variable-alignment-in-arm-embedded-tp5709962p5709998.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Playing sounds with standard components

2012-06-12 Thread Reinier Olislagers
On 9-6-2012 23:18, Jorge Aldo G. de F. Junior wrote:
> You can use OpenAL or SDL...

Found a framework that apparently uses SDL. Says it plays OGG and WAV.

Haven't tried it..

https://github.com/freezedev/elysion

Regards,
Reinier
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Playing sounds with standard components

2012-06-12 Thread michael . vancanneyt



On Tue, 12 Jun 2012, Reinier Olislagers wrote:


On 9-6-2012 23:18, Jorge Aldo G. de F. Junior wrote:

You can use OpenAL or SDL...


Found a framework that apparently uses SDL. Says it plays OGG and WAV.

Haven't tried it..

https://github.com/freezedev/elysion


SDL is so easy, it's hardly necessary to create a wrapper.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Playing sounds with standard components

2012-06-12 Thread Graeme Geldenhuys
On 12 June 2012 09:49,   wrote:
>
>
> SDL is so easy, it's hardly necessary to create a wrapper.


+1

And because SDL is a cross platform framework, there is nothing
special to do in your code to get it to work on multiple platforms.



-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Unit initialization in dll initialization for arm/WinCE

2012-06-12 Thread kyan
OK, I apologize. It seems that the problem lies elsewhere. The fact
that library initialization seems to be deferred until you do a
GetProcAddress() confused me. The problem is that function
GetModuleName() is stubbed out in WinCE (and Linux):

unit SysUtils.inc;

function GetModuleName(Module: HMODULE): string;
begin
{$ifdef MSWINDOWS}
  SetLength(Result,MAX_PATH);
  SetLength(Result,GetModuleFileName(Module, Pchar(Result),Length(Result)));
{$ELSE}
  Result:='';
{$ENDIF}
end;

The function GetModuleFileName() exists (although it is unicode) in
WinCE: http://msdn.microsoft.com/en-us/library/ms908441.aspx

And from what I've found in the web a Linux implementation is possible
using dladdr().

On Mon, Jun 11, 2012 at 1:53 PM, Sven Barth  wrote:
> Am 11.06.2012 12:25, schrieb kyan:
>
>> Does unit initialization in libraries (.dll files) work in arm/WinCE?
>
>
> From the startup code of arm-wince I don't see why it should not work...
>
>
>> Somehow it seems that even code placed in the library initialization
>> begin end block isn't executed either.
>
>
> How did you test this?
>
>
>> I found some bug reports (e.g.
>> 0019404) suggesting that this didn't work for arm/Linux but it has
>> been added to the trunk. But not for arm/WinCE?
>
>
> Linux and Windows have different schemes for library initialization, so even
> if it was the case that arm-wince did not work it would not help to apply
> the fix for arm-linux there as well.
>
> Regards,
> Sven
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Playing sounds with standard components

2012-06-12 Thread silvioprog
2012/6/12 Graeme Geldenhuys :
> On 12 June 2012 09:49,   wrote:
>>
>>
>> SDL is so easy, it's hardly necessary to create a wrapper.
>
>
> +1
>
> And because SDL is a cross platform framework, there is nothing
> special to do in your code to get it to work on multiple platforms.
>
> --
> Regards,
>   - Graeme -

So, how to play audio (wav/mp3) with only SDL framework in Free Pascal?

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Unit initialization in dll initialization for arm/WinCE

2012-06-12 Thread Sven Barth
Am 12.06.2012 15:20 schrieb "kyan" :
>
> OK, I apologize. It seems that the problem lies elsewhere. The fact
> that library initialization seems to be deferred until you do a
> GetProcAddress() confused me.

It might't be that Windows (or CE only) initalizes a library only if you
use GetProcAddress at least once... I have not tested that, but it might be
an idea. If that is the case we can not influence that.

> The problem is that function
> GetModuleName() is stubbed out in WinCE (and Linux):
>
> unit SysUtils.inc;
>
> function GetModuleName(Module: HMODULE): string;
> begin
> {$ifdef MSWINDOWS}
>  SetLength(Result,MAX_PATH);
>  SetLength(Result,GetModuleFileName(Module,
Pchar(Result),Length(Result)));
> {$ELSE}
>  Result:='';
> {$ENDIF}
> end;
>
> The function GetModuleFileName() exists (although it is unicode) in
> WinCE: http://msdn.microsoft.com/en-us/library/ms908441.aspx
>
> And from what I've found in the web a Linux implementation is possible
> using dladdr().

If you want you can create a bug report. WinCE might likely be solved then,
but I can't comment on Linux or other *nix systems.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Playing sounds with standard components

2012-06-12 Thread Graeme Geldenhuys
On 12 June 2012 16:17, silvioprog  wrote:
>
> So, how to play audio (wav/mp3) with only SDL framework in Free Pascal?


Simply reading a SDL tutorial or two, will quickly let you understand
the following code. TSoundEngine is just an convenience class we
created to add extra sound events and possibly swap out sound library
frameworks in future - without needing to change our application code.
Simple design pattern practices to simply your application code and
hide complexity.

This is not the complete code, but is the gist of it.


uses
  sdl_mixer,
  sdl;

const
  // Global default extension for sound files. Set up as needed.
  SoundExt   = '.wav';

type

  PSoundBlock = {$IFDEF UseMusic}PMIX_Music{$ELSE}PMIX_Chunk{$ENDIF};


  ...
 { in our project, this code is in a TSoundPlayer class. Result is of
type PSoundBlock }
Result := {$IFDEF
UseMusic}Mix_LoadMUS{$ELSE}Mix_LoadWAV{$ENDIF}(PChar(aFilename));
if not Assigned(Result) then
  SoundEngine.MixError;
  ...



constructor TSoundEngine.Create;
begin
  if SDL_Init(SDL_INIT_AUDIO or SDL_INIT_TIMER) = -1 then
SDLError;
  if Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT,
MIX_DEFAULT_CHANNELS, 1024) = -1 then
MixError;
  {$IFDEF 
UseMusic}Mix_HookMusicFinished{$ELSE}Mix_ChannelFinished{$ENDIF}(@MusicFinished);
end;

destructor TSoundEngine.Destroy;
begin
  PlayingStop;
  MIX_CloseAudio;
  SDL_Quit;
  inherited Destroy;
end;

procedure TSoundEngine.PlayingStop;
begin
  {$IFDEF UseMusic}
  Mix_HaltMusic;
  {$ELSE}
  Mix_HaltChannel(1);
  {$ENDIF}
end;

procedure TSoundEngine.PlayingStart(aMusic: PSoundBlock);
begin
  {$IFDEF UseMusic}
  if Mix_PlayMusic(aMusic, 0) <> 0 then
MixError;
  {$ELSE}
  Mix_PlayChannel(1,aMusic, 0)
  {$ENDIF}
end;

procedure TSoundEngine.PlayingPause;
begin
  {$IFDEF UseMusic}
  Mix_PauseMusic;
  {$ELSE}
  Mix_Pause (1);
  {$ENDIF}
end;

procedure TSoundEngine.PlayingContinue;
begin
  {$IFDEF UseMusic}
  Mix_ResumeMusic;
  {$ELSE}
  Mix_Resume (1);
  {$ENDIF}
end;



-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Unit initialization in dll initialization for arm/WinCE

2012-06-12 Thread kyan
Thank you for your reply Sven.

> It might't be that Windows (or CE only) initalizes a library only if you use
> GetProcAddress at least once... I have not tested that, but it might be an
> idea. If that is the case we can not influence that.

No need to, it really doesn't matter since one has to do a
GetProcAddress() in order to be able to call anything inside a dll.
Maybe it is an optimisation that has to do with resource dlls.

> If you want you can create a bug report. WinCE might likely be solved then,
> but I can't comment on Linux or other *nix systems.

It's OK, I've wrapped GetModuleName() in a function of my own that
works as expected in Delphi, Win32, Win64 and WinCE and will stick to
that. Will report when I find some time.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Unit initialization in dll initialization for arm/WinCE

2012-06-12 Thread Tomas Hajny
On Tue, June 12, 2012 18:04, Sven Barth wrote:
> Am 12.06.2012 15:20 schrieb "kyan" :
 .
 .
>> The problem is that function
>> GetModuleName() is stubbed out in WinCE (and Linux):
>>
>> unit SysUtils.inc;
>>
>> function GetModuleName(Module: HMODULE): string;
>> begin
>> {$ifdef MSWINDOWS}
>>  SetLength(Result,MAX_PATH);
>>  SetLength(Result,GetModuleFileName(Module,
> Pchar(Result),Length(Result)));
>> {$ELSE}
>>  Result:='';
>> {$ENDIF}
>> end;
>>
>> The function GetModuleFileName() exists (although it is unicode) in
>> WinCE: http://msdn.microsoft.com/en-us/library/ms908441.aspx
>>
>> And from what I've found in the web a Linux implementation is possible
>> using dladdr().
>
> If you want you can create a bug report. WinCE might likely be solved
> then,
> but I can't comment on Linux or other *nix systems.

In any case, it's wrong that the implementation is placed in the platform
independent include file instead of the respective sysutils.pp files. :-(

Tomas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] asm statement

2012-06-12 Thread Rainer Stratmann
Is it still necessary to fill in the registers at the end of a asm statement?
What happens if there is only the end; statement without the used registers?

asm
 mov eax , ebx
end ['EAX' , 'EBX' ... ];
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: asm statement

2012-06-12 Thread leledumbo
> What happens if there is only the end; statement without the used
registers?

The compiler couldn't save the values in the registers prior to the asm
block. If they contain intermediate result, they may be gone and unexpected
result would come. CMIIW.

--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/asm-statement-tp5710019p5710020.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Unit initialization in dll initialization for arm/WinCE

2012-06-12 Thread Sven Barth

On 12.06.2012 18:27, Tomas Hajny wrote:

On Tue, June 12, 2012 18:04, Sven Barth wrote:

Am 12.06.2012 15:20 schrieb "kyan":

  .
  .

The problem is that function
GetModuleName() is stubbed out in WinCE (and Linux):

unit SysUtils.inc;

function GetModuleName(Module: HMODULE): string;
begin
{$ifdef MSWINDOWS}
  SetLength(Result,MAX_PATH);
  SetLength(Result,GetModuleFileName(Module,

Pchar(Result),Length(Result)));

{$ELSE}
  Result:='';
{$ENDIF}
end;

The function GetModuleFileName() exists (although it is unicode) in
WinCE: http://msdn.microsoft.com/en-us/library/ms908441.aspx

And from what I've found in the web a Linux implementation is possible
using dladdr().


If you want you can create a bug report. WinCE might likely be solved
then,
but I can't comment on Linux or other *nix systems.


In any case, it's wrong that the implementation is placed in the platform
independent include file instead of the respective sysutils.pp files. :-(


That can be corrected as well when support for Windows CE is added :D

Regards,
Sven

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread Florian Klaempfl

Am 08.06.2012 14:37, schrieb Jeppe Græsdal Johansen:

Den 08-06-2012 14:28, Ludo Brands skrev:

Thanks Ludo,

I'll take that as a starting point. I hope I will not need the "lost"
256 bytes in the future.

I could be wrong but AFAIK if the compiler would do the alignment, the
loss
can also be up to 255 bytes. Here you lose 256 bytes in all cases.

Yes, but this would allow the linker to place other stuff there which
fits in less than 255 bytes.

Wasting 255 bytes is a lot on systems that only has a few kilobytes of
RAM. I wonder if the restriction of 32 bytes on the align directive
could just be removed, or will we need some sort of linker script changes?


It could be removed but I'am pretty sure that the linker does not use 
the alignment space for other stuff.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpimage reader for jpeg2000

2012-06-12 Thread Florian Klaempfl

Am 11.06.2012 12:03, schrieb Mattias Gaertner:

Hi,

Has someone already implemented a fpimage reader for jpeg2000?


Probably not due to the patent situation?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpimage reader for jpeg2000

2012-06-12 Thread Mattias Gaertner
On Tue, 12 Jun 2012 20:03:40 +0200
Florian Klaempfl  wrote:

> Am 11.06.2012 12:03, schrieb Mattias Gaertner:
> > Hi,
> >
> > Has someone already implemented a fpimage reader for jpeg2000?
> 
> Probably not due to the patent situation?

I guess that's a minor:
http://www.jpeg.org/faq.phtml?action=show_answer&question_id=q3f042a68b1081

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread Florian Klaempfl

Am 12.06.2012 09:50, schrieb Koenraad Lelong:

On 08-06-12 14:37, Jeppe Græsdal Johansen wrote:

Den 08-06-2012 14:28, Ludo Brands skrev:

Thanks Ludo,

I'll take that as a starting point. I hope I will not need the "lost"
256 bytes in the future.

I could be wrong but AFAIK if the compiler would do the alignment, the
loss
can also be up to 255 bytes. Here you lose 256 bytes in all cases.

Yes, but this would allow the linker to place other stuff there which
fits in less than 255 bytes.

Wasting 255 bytes is a lot on systems that only has a few kilobytes of
RAM. I wonder if the restriction of 32 bytes on the align directive
could just be removed, or will we need some sort of linker script
changes?


Hi,

I'm still struggling to get interrupts (or even inputs) work but I
wanted to comment on the size of the table. Reading the manuals I found
it's actually on a 512 byte boundery. The VTOR (Vector Table Offset
Register) masks off the last 9 bits (8..0).
If I need that space I will modify the start of RAM location and use the
first bytes of RAM for the vector-table.
It would be nice to have "external" linker scripts. That way you could
more easily add processors,


I think extending t_embedded.pas is the more clean solution to add new 
controllers, especially because it makes it easier for other people to 
use the added controllers.



or use custom bootloaders.

Regards,

Koenraad Lelong.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpimage reader for jpeg2000

2012-06-12 Thread Jonas Maebe

On 12 Jun 2012, at 20:07, Mattias Gaertner wrote:

> On Tue, 12 Jun 2012 20:03:40 +0200
> Florian Klaempfl  wrote:
> 
>> Am 11.06.2012 12:03, schrieb Mattias Gaertner:
>>> 
>>> Has someone already implemented a fpimage reader for jpeg2000?
>> 
>> Probably not due to the patent situation?
> 
> I guess that's a minor:
> http://www.jpeg.org/faq.phtml?action=show_answer&question_id=q3f042a68b1081

The problem is that this "fee-free" patent license only applies to using those 
patented algorithms for jpeg2000 encoding/decoding. This means that you cannot 
use such code together with e.g. GPL code, since the GPL requires that the 
recipient can use/adapt the result for any reason and any purpose. You don't 
have the ability to grant those rights to the recipients.

A BSD-licensed implementation might be possible, but I'm not 100% sure about 
how that would work either (since that license also grants the recipient the 
right to do whatever they want with the code, as long as they keep the 
copyright notice intact -- which again is not a license you can grant due to 
the patent restrictions).

I guess you'd need to use some specific license for such code, and then clearly 
mark with which other licenses the code is (in)compatible.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread Florian Klaempfl

Am 11.06.2012 13:46, schrieb alrieckert:

Hi Jeppe,

I've been using the actual ROM based interrupt table for the past
month now in freepascal ad it seems to work great. No need to declare
a block of RAM and pointing the interrupt table to it.

You can code any procedure and just give it the interrupt keyword
with an address index.

For example:



There are 3 patches you need to apply to your compiler. I'll try to
submit the patches to the Freepascal mailing list and hopefully
someone will accept them, but in the mean time you can find them
here.


Better submit a bug tracker entry. This way it cannot get lost.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: asm statement

2012-06-12 Thread Rainer Stratmann
Am Tuesday 12 June 2012 18:44:20 schrieb leledumbo:
> > What happens if there is only the end; statement without the used
>
> registers?
>
> The compiler couldn't save the values in the registers prior to the asm
> block. If they contain intermediate result, they may be gone and unexpected
> result would come. CMIIW.
>
Here there is no such mentioning of the used registers in the asm statement.
http://wiki.freepascal.org/Lazarus_Inline_Assembler
(last modified on 24 March 2012)

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: asm statement

2012-06-12 Thread Alexander Shishkin

12.06.2012 23:23, Rainer Stratmann пишет:

Am Tuesday 12 June 2012 18:44:20 schrieb leledumbo:

What happens if there is only the end; statement without the used


registers?

The compiler couldn't save the values in the registers prior to the asm
block. If they contain intermediate result, they may be gone and unexpected
result would come. CMIIW.


Here there is no such mentioning of the used registers in the asm statement.
http://wiki.freepascal.org/Lazarus_Inline_Assembler
(last modified on 24 March 2012)

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


This is described in PFC documentation: Programmer`s guide, ch 3.4 
"Signaling changed registers".


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] asm statement

2012-06-12 Thread Jonas Maebe

On 12 Jun 2012, at 18:41, Rainer Stratmann wrote:

> Is it still necessary to fill in the registers at the end of a asm statement?

Yes.

> What happens if there is only the end; statement without the used registers?

Then the compiler will assume that the assembler code can change all 
callee-saved registers for the current target platform, and that it will not 
modify any caller-saved registers. If you don't know what the 
callee/caller-saved registers of all of your current and future supported 
target platforms are (possibly even targets that do not yet exist), or if you 
simply don't want the compiler to needlessly save and restore all callee-saved 
registers even when you don't modify them (it would be rather strange to resort 
to assembler and then force the compiler to generate suboptimal code), then you 
should specify the registers that are overwritten by your assembler code.

And no, the compiler cannot automagically figure this out for you. It does not 
contain an abstract interpretation infrastructure for assembler that can 
determine what registers are changed and not saved/restored by the code, neatly 
sidestepping the halting problem in the process. Anything less would result in 
a lot of work with either only suboptimal or unsafe results.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread Koenraad Lelong

On 11-06-12 13:46, alrieckert wrote:

Hi Jeppe,

I've been using the actual ROM based interrupt table for the past month now
in freepascal ad it seems to work great. No need to declare a block of RAM
and pointing the interrupt table to it.


...


Please let me know if you have any questions.

--
Anton


Hi Anton,

I just tried something, but it seems that the vector table is not 
updated. I enclose my project.
This afternoon I downloaded your whole git-repo following your links. I 
compiled my crosscompiler. Then I tried a bare project. First I found 
that the flash-start was wrong. I corrected that and recompiled the 
compiler. Then I compiled the bare-program again. I didn't find my 
systick-handler (optimized away !?). Then I tried to "use" the handler 
and now I see the systick-handler in the disassembly (bare.dis). 
Unfortunately, I don't see the address of the systick-handler in the 
vector-table.


What am I doing wrong ?

Koenraad.


Bare.tar.bz
Description: application/bzip
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Playing sounds with standard components

2012-06-12 Thread silvioprog
2012/6/12 Graeme Geldenhuys :
> On 12 June 2012 16:17, silvioprog  wrote:
>>
>> So, how to play audio (wav/mp3) with only SDL framework in Free Pascal?
>
>
> Simply reading a SDL tutorial or two, will quickly let you understand
> the following code. TSoundEngine is just an convenience class we
> created to add extra sound events and possibly swap out sound library
> frameworks in future - without needing to change our application code.
> Simple design pattern practices to simply your application code and
> hide complexity.
>
> This is not the complete code, but is the gist of it.
>
>
> uses
>  sdl_mixer,
>  sdl;
>
> const
>  // Global default extension for sound files. Set up as needed.
>  SoundExt           = '.wav';
>
> type
>
>  PSoundBlock = {$IFDEF UseMusic}PMIX_Music{$ELSE}PMIX_Chunk{$ENDIF};
>
>
>  ...
>  { in our project, this code is in a TSoundPlayer class. Result is of
> type PSoundBlock }
>    Result := {$IFDEF
> UseMusic}Mix_LoadMUS{$ELSE}Mix_LoadWAV{$ENDIF}(PChar(aFilename));
>    if not Assigned(Result) then
>      SoundEngine.MixError;
>  ...
>
>
>
> constructor TSoundEngine.Create;
> begin
>  if SDL_Init(SDL_INIT_AUDIO or SDL_INIT_TIMER) = -1 then
>    SDLError;
>  if Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT,
> MIX_DEFAULT_CHANNELS, 1024) = -1 then
>    MixError;
>  {$IFDEF 
> UseMusic}Mix_HookMusicFinished{$ELSE}Mix_ChannelFinished{$ENDIF}(@MusicFinished);
> end;
>
> destructor TSoundEngine.Destroy;
> begin
>  PlayingStop;
>  MIX_CloseAudio;
>  SDL_Quit;
>  inherited Destroy;
> end;
>
> procedure TSoundEngine.PlayingStop;
> begin
>  {$IFDEF UseMusic}
>  Mix_HaltMusic;
>  {$ELSE}
>  Mix_HaltChannel(1);
>  {$ENDIF}
> end;
>
> procedure TSoundEngine.PlayingStart(aMusic: PSoundBlock);
> begin
>  {$IFDEF UseMusic}
>  if Mix_PlayMusic(aMusic, 0) <> 0 then
>    MixError;
>  {$ELSE}
>  Mix_PlayChannel(1,aMusic, 0)
>  {$ENDIF}
> end;
>
> procedure TSoundEngine.PlayingPause;
> begin
>  {$IFDEF UseMusic}
>  Mix_PauseMusic;
>  {$ELSE}
>  Mix_Pause (1);
>  {$ENDIF}
> end;
>
> procedure TSoundEngine.PlayingContinue;
> begin
>  {$IFDEF UseMusic}
>  Mix_ResumeMusic;
>  {$ELSE}
>  Mix_Resume (1);
>  {$ENDIF}
> end;
>
>
>
> --
> Regards,
>   - Graeme -

Hellow Graeme! :)

I'll try to test it tomorrow and return here with the results ...

Thank you in advance guy! :)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread alrieckert
Hi Koenraad,

Glad to see more people that want to make use of Freepascal for STM32.

I've had a quick look at your project and everything seems fine. The only
thing I noted is that the interrupt procedures must be in a separate unit.
I've changed your project and recompiled it and now it seems fine.

Please just make sure about your starting address for the flash. I'm using
the STM32F103CBT6 and the start address is 0x0800 and not 0x080

I'll have a look at why the interrupt procedures needs to be separate and
get back to you.

I've also attached one of my sample projects that you can test with. The
project will blink a LED on PortB.8 making use of the Systick timer and echo
all data send to it via USART1 back making use of the USART interrupt. It
also includes a large set of the STM32 StdPeripheral libraries that is
ported to Pascal.

Regards
Anton

http://free-pascal-general.1045716.n5.nabble.com/file/n5710034/Bare2.tar.gz
Bare2.tar.gz 
http://free-pascal-general.1045716.n5.nabble.com/file/n5710034/test.tar.gz
test.tar.gz 

--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Variable-alignment-in-arm-embedded-tp5709962p5710034.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread alrieckert

alrieckert wrote
> 
> I'll have a look at why the interrupt procedures needs to be separate and
> get back to you.
> 

Ok, the compiler was only scanning the used source files for interrupt
procedures and not the main file as well. I've added the necessary code to
ncgutil.pas that will allow the compiler to scan the main project file as
well.

https://github.com/alrieckert/freepascal/commit/0589b86b052cc0711f69d4f61f9f4869f6b95cc4
https://github.com/alrieckert/freepascal/commit/0589b86b052cc0711f69d4f61f9f4869f6b95cc4
   

Your project should now generate the Vector table correctly. Please keep me
informed.

Regards
Anton

--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Variable-alignment-in-arm-embedded-tp5709962p5710035.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread alrieckert

alrieckert wrote
> 
> Please just make sure about your starting address for the flash. I'm using
> the STM32F103CBT6 and the start address is 0x0800 and not 0x080
> 
I've just verified it. The starting address for the flash should be
0x0800. The reason for mine being 0x08003000 is that I'm making use of a
USB DFU bootloader to load my program onto the device.

Would be nice if we could specify the flash start offset at compile (link)
time and not to hard code this into the compiler?

Regards
Anton 


--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Variable-alignment-in-arm-embedded-tp5709962p5710036.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal