Re: [fpc-pascal] 64-bit ARM and CPUARM

2024-05-21 Thread Christo Crause via fpc-pascal
On Tue, May 21, 2024 at 10:37 AM Ched via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> In https://www.freepascal.org/docs-html/prog/progap7.html , there is
> specified that
> CPUARM  Free Pascal target is an ARM 32-bit processor.
>
> What about ARM 64-bit processors like the ones in Raspberries ?
> Something similar to CPUPOWERPC with two subcatagories CPUPOWERPC32 and
> CPUPOWERPC64 ?
>
>
ARM-64 is called aarch64 in FPC, so the define should be something like
CPUAARCH64
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Forking the GitLab FPC Source repository

2023-05-01 Thread Christo Crause via fpc-pascal
On Mon, May 1, 2023 at 4:24 PM Norman Dunbar via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> On 30/04/2023 16:59, Michael Van Canneyt via fpc-pascal wrote:
>
> > The repo is not private.
> Ok, thanks. my assumption was obviously incorrect then.
>
>
> > One possible reason is that the repo is simply too big: it has 26 years
> of
> > commits.
> >
> > We had serious problems importing it for this very reason.
> Again, thanks. I'll attempt a different method.
>

FWIW, there are currently 68 forks of the FPC source repository on GitLab.
I forked the repository shortly after it was created, at the time there
were no issues.  I do not expect the size of the repository to be a problem
when creating a fork, there is probably some GitLab related issue.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] IRC channel for FreePascal support ?

2023-04-13 Thread Christo Crause via fpc-pascal
On Thu, Apr 13, 2023 at 11:39 AM Tomas Hajny via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> On 2023-04-13 11:23, Jacob Kroon via fpc-pascal wrote:
>
>
> Hi Jacob,
>
>   .
>   .
> > Ok, maybe this "Joanna" is on this mailing list and would care to
> > elaborate more why I got banned ?
> >
> > The same "Joanna" also kicked me out of the channel a couple of days
> > ago with the reason that "we don't allow lurkers", since I was
> > inactive in the chat.
>
> Just FYI - I don't see anybody having name "Joanna" among people
> subscribed to this mailing list, and nobody like that has been
> considerably active here in the last years as far as my memory serves
> correctly. Obviously, the address and/or name may be completely
> different from the IRC nickname, thus it doesn't mean that you wouldn't
> get the response here for sure. I can't check the list of people
> subscribed to FPC forum, the person may be active there.
>
> Tomas
> (one of FPC mailing list moderators)
>

Most probably user Joanna on the Lazarus/FPC forum:
https://forum.lazarus.freepascal.org/index.php?action=profile;area=summary;u=64282
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC/Lazarus on RPi4 - How to read/write I2C connected EEPROM?

2023-04-05 Thread Christo Crause via fpc-pascal
On Wed, Apr 5, 2023 at 12:43 PM Bo Berglund via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> On Wed, 5 Apr 2023 11:40:09 +0200, Christo Crause via fpc-pascal
>  wrote:
> >Looking at the datasheet for CAT24C128, Fig. 6 Byte Write Sequence, shows
> >no repeated start condition between register address and data bytes. I
> >suspect that the second i2c message should contain the I2C_M_NOSTART flag,
> >else the address and data parts of the transaction will be separated by a
> >repeated start signal. I have modified the WriteBytesToReg methods in
> >i2c.pas, please feel free to pull from Github and test this again.
>

I tested the i2c code with a PCA9685 IC.  It also supports multi-byte
writes, although it only has 8 bit register addresses.  I realised that my
original code used two i2c transactions and that each transaction starts
with sending the device address.  The multibyte write obviously doesn't
work like this, so I changed the WriteBytesToReg methods (in i2c.pas) to
combine the register address and data into one buffer, which is then
transmitted using the WriteBytes method.

This was tested and confirmed when writing 4 bytes to sequential registers
to a PCA9685 IC with the new WriteBytesToReg method (
https://github.com/ccrause/rpiplc_pas/blob/dc568bbfba2cda50f7ba394469480109e652247d/native/pwm_pca9685.pas#L227
).

Only the WriteBytesToReg for 16 bit register addresses are now untested,
although it follows a similar pattern so I have a reasonable expectation
that it should work.

If this update still doesn't work, I will need a logic analyser trace of an
i2c write transaction that is successful (say using i2ctrace) and one which
is unsuccessful using TI2cMaster.WriteBytesToReg.  Or I need to find a
similar EEPROM to test...

Thanks, I did so and used it in my code but it still does not write the
> EEPROM...
>
> Here is the code I use to test (in a command line program), maybe you can
> see a
> usage problem?
>
> var
>   i2cbus,
>   dev_addr,
>   reg_addr,
>   data_cnt: integer;
>   indata: TBytes;
>
> procedure main_12c_write(); //This is the main application procedure
> var
>   i: integer;
>   num: uint16;
>   i2cEeprom: TI2c_eeprom;
> begin
>   processInputs; //Read command line and write to variables
>   //Now process the data towards the EEPROM
>   i2cEeprom := TI2c_eeprom.Create; //Defaults are set for my EEPROM
>   try
> num := i2cEeprom.WriteData(reg_addr, data_cnt, indata);
> Writeln('Wrote ' + IntToStr(num) + ' bytes to address $' +
> IntToHex(reg_addr,4) );
>   finally
> i2cEeprom.Free;
>   end;
>
> function TI2c_eeprom.WriteData(StartAddress, NumBytes: uint16; Source:
> TBytes):
> uint16;
> var
>   endpos, capacity, addr: uint16;
>   i2cMaster: TI2cMaster;
>   i2cbus: TI2CBus;
>   sourcelen, i, j: integer;
>   pSource: PByte;
> begin
>   Result := 0;
>   //Check valid indata:
>   //snip
>   //Prepare the handler for action...
>   i2cbus := TI2CBus(FI2cBusNo);
>   i2cMaster := TI2cMaster.Create;
>   try
> if not i2cMaster.Initialize(i2cbus) then
> begin
>   writeln('Error opening i2c device: ', FI2cBusNo);
>   exit;
> end;
>
> //Check if data will fit into a single page start at given address:
> if ((StartAddress and $ffc0) = (endpos and  $ffc0)) then //Fits in page
> begin
>   //Perform a single write cycle into the buffer
>   pSource := @source[0];
>   if not i2cMaster.WriteBytesToReg(FEEPROMAddr, startaddress, pSource,
> NumBytes) then
>   begin
> Writeln('Error: Could not write to I2C device!');
> exit;
>   end
>   else
> Result := NumBytes;
> end
> else  //We need to split data over several commands
> begin
>   Writeln('Not yet implmented data split into several writes');
> end;
>   finally
> i2cMaster.Free;
>   end;
>

The use of WriteBytesToReg in the TI2c_eeprom.WriteData method seems fine,
perhaps retest with the updated WriteBytesToReg method.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC/Lazarus on RPi4 - How to read/write I2C connected EEPROM?

2023-04-05 Thread Christo Crause via fpc-pascal
On Wed, Apr 5, 2023 at 11:22 AM Jean SUZINEAU via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> May be you could get the source code of i2ctransfer from i2c-tools and
> compare it with the code in i2c.pas ?
>

Good idea, that led to the suggestion to try the WriteBytes method which is
similar to how i2ctransfer constructed the i2c transaction.  Hopefully the
change to the WriteBytesToReg methods also fixes the original problem,
since it is a little bit more convenient to work with.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC/Lazarus on RPi4 - How to read/write I2C connected EEPROM?

2023-04-05 Thread Christo Crause via fpc-pascal
On Wed, Apr 5, 2023 at 7:55 AM Bo Berglund via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> On Wed, 05 Apr 2023 00:33:50 +0200, Bo Berglund via fpc-pascal
>
> I *can* write a sequence of bytes into the EEPROM succsessfully using an
> i2c-tools command like this:
>
> i2ctransfer -y 1 w18@0x50 0x00 0x38 0x00 0x01 0x02 0x03 0x04 0x05 0x06
> 0x07 0x08
> 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f
>
> This writes data starting towards the end of the page and wraps around
> such that
> part of the data gets to the start of the page.
>

Looking at the i2ctransmit transaction data:
$ i2ctransfer 1 w18@0x50 0x00 0x38 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will send the following messages to device file /dev/i2c-1:
msg 0: addr 0x50, write, len 18, buf 0x00 0x38 0x00 0x01 0x02 0x03 0x04
0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f

This can be simulated by calling the WriteBytes method, see new example:
https://github.com/ccrause/rpiplc_pas/blob/main/native/examples/i2c_write_test.lpr

It shows:
> - It is possible to write the data in one go
> - If the data length is past the end of the page it wraps around to the
> beginning
>
> So if the problem cannot be solved then I could either use the loop with
> delay
> or call the i2c-tools command i2ctransfer as a TProcess execution to write
> multiple bytes in one command.
>
> But I would rather not use the TProcess method at all since it relies on an
> external tool being present and the argument list can be pretty long and
> tedious
> to build...
>

Looking at the datasheet for CAT24C128, Fig. 6 Byte Write Sequence, shows
no repeated start condition between register address and data bytes. I
suspect that the second i2c message should contain the I2C_M_NOSTART flag,
else the address and data parts of the transaction will be separated by a
repeated start signal. I have modified the WriteBytesToReg methods in
i2c.pas, please feel free to pull from Github and test this again.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC/Lazarus on RPi4 - How to read/write I2C connected EEPROM?

2023-04-04 Thread Christo Crause via fpc-pascal
See comments below.

On Tue, Apr 4, 2023 at 6:52 PM Bo Berglund via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> I use the method:
>
> i2cMaster.WriteBytesToReg(i2caddress: byte; regAddress: uint16; data:
> PByte;
> size: byte): boolean;)
>
> With data specified as follows in the call:
>
> if not i2cMaster.WriteBytesToReg(FEEPROMAddr, startaddress, @source[0],
> NumBytes) then
>
> Here the source argument is a TBytes array of bytes so I supply the
> address of
> element 0 as the data argument (expected to be a PByte).
>

This is the correct way of passing the starting address of your data
buffer.  Is your startaddress variable an unsigned 16 bit integer
(word/uint16)? If not, type cast this to a uint16 to ensure the compiler
calls the correct overloaded method.


> When I step through this in the debugger and get into the method itself I
> can
> see that the source argument contains the data I have loaded into it, so
> the
> data is there.
>
> When I run that method to the end and it finishes without error, I still
> cannot
> see the data in the EEPROM at the given address.
>
> So for testing I changed the call to be:
> if not i2cMaster.WriteByteToReg(FEEPROMAddr, startaddress, source[0]) then
>
> This uses the method to write a single byte to the i2c device and it works
> just
> fine!
>
> So either there is a problem with the WriteBytesToReg() method or else my
> use of
> it...
>

Note that I haven't tested WriteByteToReg with a device supporting 10 bit
register addresses, or in your case 16 bit...


> What comes to mind is the data type PByte, which I have never used before
> and do
> not know if it is valid.
>

PByte is a pointer to a byte.


> I am keeping the data in a dynamic array of bytes (the pascal type TBytes)
> and
> send the address of element 0 of that array as the argument to the method.
> Is this wrong?
>

Passing the address of the first element of a TBytes array as you did above
is correct.

If so what should I use instead?
> Can I typecast it like this:
>
> if not i2cMaster.WriteBytesToReg(FEEPROMAddr, startaddress, PByte(source),
> NumBytes) then
> (Tried it and it does not work)
>

No, this does not take the address of source, which is waht is required.


> 
>
> Seems like I am getting close but missing something important...
>

I will look at the EEPROM datasheet, in case the details do not agree with
the WriteBytesToReg implementation.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC/Lazarus on RPi4 - How to read/write I2C connected EEPROM?

2023-04-02 Thread Christo Crause via fpc-pascal
On Sun, Apr 2, 2023 at 9:30 PM Bo Berglund via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Is there a reason that there is no i2c_write_reg demo in the github
> package?
>

I haven't gotten round to that, waiting for hardware to test the code with.

I will try to write one so I can test that as well...
>
Would be nice if you could share that :-)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC/Lazarus on RPi4 - How to read/write I2C connected EEPROM?

2023-04-01 Thread Christo Crause via fpc-pascal
On Sat, Apr 1, 2023 at 9:57 PM Bo Berglund via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Question:
> Can I use Linux file system commands to read/write the data on the i2c
> EEPROM
> memory device and if so how from fpc?
>

To some extent it is possible to handle i2c transactions as file read/write
operations, but some ioctl calls are required to configure e.g. the device
address [1]. Take note that only a subset of i2c functionality is available
using read/write calls. Lazi2cdev [2] uses this approach.

For finer control over the i2c transactions (for example combined
write/read transactions) low level ioctl calls are available in Linux.  I
wrote an i2c class [3] using this approach.

1. https://www.kernel.org/doc/html/latest/i2c/dev-interface.html
2. https://github.com/laz2wiringpi/lazI2cdev/blob/master/i2cdev_base.pas
2. https://github.com/ccrause/rpiplc_pas/blob/main/native/i2c.pas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Working on a new way to educate people about pascal

2022-12-27 Thread Christo Crause via fpc-pascal
On Tue, Dec 27, 2022 at 6:47 PM Anthony Walter via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> My idea is to implement a web page system where syntax highlight code is
> presented like in the Lazarus IDE, and special links are peppered through
> and explanation of how and why Pascal works by using some example programs.
> When the user highlights the special link, the relevant source code is
> highlighted in the syntax window. This then hopefully allows people to
> understand a bit more about pascal by pairing the explanations with lines
> of source code.
>
> Let me know if you think this approach has any merit or if you think my
> guide could be altered to be a bit more clean in places. As a reminder,
> this page is a wiki, so you cna submit edits to me by clicking the edit
> link at the top of the page. I am able to see and merge your edits.
>

I like the concept implemented in this guide.  A small problem I noticed is
when the source code snippet linked to is not visible, clicking the link
does not move the code snippet into view. This is obviously a tricky
situation since moving the code into view may require shifting the rest of
the document, which may not be desirable.

Explaining the layout and structure of a Pascal program using an example is
a good idea. However, the example topic is quite advanced so a
non-programmer would probably be completely lost regarding the purpose of
the code itself.  Programmers from other languages may also not understand
the concept of a form or the Application instance.  As suggested, perhaps
the example itself should be simple enough so that a non-programmer can
understand the intention of the code.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] [Question] How to submit our patch?

2022-10-10 Thread Christo Crause via fpc-pascal
On Mon, Oct 10, 2022 at 11:47 AM Jinyang He via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> We, a team working for Loongson, are ready to submit some patches which
> support a new architecture named LoongArch for FreePascal. [1] is one of
> repositories about LoongArch. LoongArch is a RISC architecture. The work
> of Loongson was based on MIPS in the past. So LoongArch is somewhat
> similar to MIPS. Of course, there are also commonalities with other RISC
> architectures such as aarch64, riscv, etc. Patches that support LoongArch
> also refer to many other architectures. I have to show my respect to the
> others who contributed FreePascal.
>
> Which way can we submit these patches? I guess we should create a
> 'merge requests' in Gitlab. Is it correct? I hope to find some official
> documentation, or some discussion from the list. All answers are
> needed. Thanks.
>
> [1] https://github.com/loongson


Thank you for offering patches to support LoongArch in FPC.

Also send this message to the FPC developers' mailing list (
fpc-de...@lists.freepascal.org), not all the compiler developers may be
monitoring this list.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] SerReadTimeout question

2022-09-19 Thread Christo Crause via fpc-pascal
On Mon, Sep 19, 2022 at 7:51 AM Christo Crause 
wrote:

>
>
> On Mon, 19 Sep 2022, 03:18 James Richters via fpc-pascal, <
> fpc-pascal@lists.freepascal.org> wrote:
>
>> I can't seem to find any documentation or SerRead or SerReadTimeout..
>> searching for either along with Freepascal doesn't get me any results.
>> If it exists somewhere and I am just missing it, can someone tell me where
>> it is?
>>
>> Anyway, what I'm trying to figure out is when the timeout timer starts...
>>
>
> FPC uses the OS provided functionality to interact with the serial port.
> On Windows the timeout seems to start when the read request is made (
> https://learn.microsoft.com/en-us/previous-versions/ff547486(v=vs.85)).
> On POSIX (at least Linux) it depends on the specific set of flags specified
> , scroll down to the discussion on canonical/noncanonical mode for the
> details (https://linux.die.net/man/3/termios).
>

A bit more information after peeking into the source code: on win32 the
timeout information can be read or set using Get/SetCommTimeouts. The
COMMTIMEOUTS structure (
https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-commtimeouts)
contains a read interval timeout and total timeouts for read & write
operations. SerReadTimeout sets the ReadTotalTimeoutConstant value, so
basically the total timeout duration.

On Linux SerReadTimeout uses a fpSelect on the handle with the specified
timeout, so in principle it is the same behaviour as on Windows, i.e. a
total timeout.

While both OSs provide some functionality to specify inter character
timeouts, FPC does not directly expose this functionality in the Serial
unit.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] SerReadTimeout question

2022-09-18 Thread Christo Crause via fpc-pascal
On Mon, 19 Sep 2022, 03:18 James Richters via fpc-pascal, <
fpc-pascal@lists.freepascal.org> wrote:

> I can't seem to find any documentation or SerRead or SerReadTimeout..
> searching for either along with Freepascal doesn't get me any results.
> If it exists somewhere and I am just missing it, can someone tell me where
> it is?
>
> Anyway, what I'm trying to figure out is when the timeout timer starts...
>

FPC uses the OS provided functionality to interact with the serial port. On
Windows the timeout seems to start when the read request is made (
https://learn.microsoft.com/en-us/previous-versions/ff547486(v=vs.85)). On
POSIX (at least Linux) it depends on the specific set of flags specified ,
scroll down to the discussion on canonical/noncanonical mode for the
details (https://linux.die.net/man/3/termios).

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Test Free Pascal program not compiling

2022-09-11 Thread Christo Crause via fpc-pascal
On Mon, 12 Sep 2022, 02:59 Terry A. Haimann via fpc-pascal, <
fpc-pascal@lists.freepascal.org> wrote:

> Trying to compile a small test pascal program on a arm cpu.  I beleive
> it is an a53.  Libre Le Potato
>
> I am getting the following error:
>
> Error: Error while assembling exitcode 1
>
> Thanks in advance,
>
> Terry H.
>

Enable the compiler's verbose mode (-va). The real error is sometimes
printed much earlier in the compiler output.

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC Backtrace

2022-01-03 Thread Christo Crause via fpc-pascal
On Mon, Jan 3, 2022 at 3:28 PM James Richters via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> I’m curious if there is some way, perhaps with some directive or something
> to force a debug backtrace to happen, but without an error
>

Try calling Dump_Stack in your code:
https://freepascal.org/docs-html/rtl/system/dump_stack.html
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Keeping current with FPC Source on gitlab

2021-11-06 Thread Christo Crause via fpc-pascal
On Sat, 6 Nov 2021, 02:09 James Richters via fpc-pascal, <
fpc-pascal@lists.freepascal.org> wrote:

> Do I need to use the source to re-install FPC every time I want to update
> it?  If so how is this accomplished?
>
> Or is there a better way to just update everything when I update the
> repository without re-installing it?
>

To build the compiler, rtl and packages from newly updated source, call
make clean all

from the base folder of the source containing the compiler, rtl etc
folders. This will produce a new compiler located in the compiler folder.
It will be called something like ppcx64 (depends on your host
architecture).  Compiled units for rtl are located in rtl/units/$fpctarget
and packages will sit under packages/*/units/$fpctarget.

a) You can use this as is without installing, but then your config file
needs to be updated with the relevant locations to units and utilities.
Either call ppcx64 (or your target compiler) directly, or build the fpc
frontend located in compiler/utils, then copy the resulting fpc executable
into the compiler folder from where it can call the target specific
executables.  Since this folder layout is most likely different from the
installed layout, use a different fpc.cfg file with paths updated according
to the source structure.

b) You can install the new compiler (make install), which would typically
overwrite the existing installed version.  Or you can install to a custom
location by specifying INSTALL_PREFIX=path/to/install/folder.  You need the
previous stable compiler to start the build process, so do not overwrite
the installed version.  This also requires a custom fpc.cfg, since the base
folder will be different to the installed path.

For either of the options, call the compiler with the option -n to not load
the default config file (which would point to the installed version,
leading to unit version conflicts) and @/path/to/new/fpc.cfg so that the
compiler can load the new config.

Notes
1. I'm using Linux conventions above, translate path separators and .exe
extensions as required for Windows.
2. If the stable compiler is not in the path, add
FPC=path/to/compiler/ppcx64 to the make commands.
3. There are many more permutations I'm sure, these are just the options
I've managed to get working.

As Ryan mentioned, you have to frequently (if you want to stay up to date)
update the source (git pull), then rebuild.  So configuring your setup
initially is key, after that it is relatively simple to stay up to date.

On a personal note, I got tangled up with config files and conflicts
between old and new compiler versions in the past. When you run into
strange compiler errors about not finding units, or invalid PPU versions or
some such, take note of the paths used for the compiler, config file and
the relevant units.  My strategy was to never install fpc into the search
path, always specify the path to the compiler executable and know when the
compiler should ignore the default and load a specific config file for the
particular compiler.

Alternatively use fpcupdeluxe, it has an option to checkout and build
main.  I haven't tested this much, since I'm comfortable with my workflow.
There is an active thread on the Lazarus forum for fpcupdeluxe support.

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Conversion from C to Pascal - Left bit shift

2021-09-03 Thread Christo Crause via fpc-pascal
On Fri, Sep 3, 2021 at 8:02 AM LacaK via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Can we say that in Pascal the result of:
>E1 shl E2
> is of same type as E1 ?
> (so if E1 is LongWord then result is LongWord also?)
>
> What if there is an expression on left side:
>(E1*x) shl E2
> Will E1*x promote to 64 bits (on 64 bit target)?
>

See documentation on automatic type conversion (the remarks section below
table 3.3): https://www.freepascal.org/docs-html/ref/refsu4.html#x26-26004r3
While this doesn't explicitly mention shift behaviour, it implies that E1
and (E1*x) will be promoted to native sized integer if smaller.  For the
first example, if E1 is a longword on a 32 bit machine, the result should
also be a longword.

Personal note:  I find the naming of ordinal types confusing.  Is shortint
smaller than smallint, or smallint shorter than shortint? In FPC a word is
2 bytes in size, however on the hardware side a word refers to "the natural
unit of data used by a particular processor design" (
https://en.wikipedia.org/wiki/Word_(computer_architecture)).  I prefer to
use the type aliases with explicit mention of size, such as int16, uint8
etc. I assume the flip side of this is when trying to write portable code
that uses the most efficient size available on a target.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to get fpc and lazarus sources when svn has shut down?

2021-08-12 Thread Christo Crause via fpc-pascal
On Thu, Aug 12, 2021 at 7:34 AM LacaK via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

>
> I have related question: in SVN was possible to checkout specific
> sub-directory (for example if I am interested in fcl-db package only I
> checkedout only this sub-directory).
> Is it possible with gitlab? Or I must clone whole
> https://gitlab.com/freepascal.org/fpc/source ?
>

There is a relatively new git feature "sparse-checkout" that could
potentially be used in this case (I haven't tested this).  See e.g.
https://stackoverflow.com/a/60729017/13781629
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to get fpc and lazarus sources when svn has shut down?

2021-08-12 Thread Christo Crause via fpc-pascal
On Thu, Aug 12, 2021 at 12:50 AM Bo Berglund via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> On Wed, 11 Aug 2021 22:22:54 +0200 (CEST), Michael Van Canneyt via
> fpc-pascal
>  wrote:
>
> ># Get sources
> >git clone https://gitlab.com/freepascal.org/fpc/source.git  $FPCVER
> ># switch to branch/tag
> >cd $FPCVER
> >git checkout $FPCTAG
> >cd ..
>
> How big a size is the git clone going to pull?
>
> By the looks of it I get the impression that the git clone will download
> every
> single tag/branch/commit etc ever done and then the git checkout activates
> the
> actual tagged file set?
> If this is correct then the size on disk will be too big.
>
> Now as I said I have not used git and for my day use cannot switch because
> we
> use properties of svn that are simply not available in git...
>

To retrieve a specific branch without history (I think this is
approximately equivalent to the svn co command) specify options --branch
(to specify which branch to check out),  --single-branch (to not pull in
other branches) and --depth (to limit the history that git pulls in):

git clone --depth=1 --branch fixes_3_2 --single-branch
https://gitlab.com/freepascal.org/fpc/source.git fpc-fixes_3_2

This example downloads about 46 MiB of data, which expands to around 309
MiB on disk, of which 50 MiB is git information.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Interruption handling on i8086

2021-04-10 Thread Christo Crause via fpc-pascal
On Sat, Apr 10, 2021 at 10:14 AM Guillermo via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Hi pascaloids,
>
> I'm doing DOS development for fun and, after installing the compiler
> (was quite hard), I'm having problems handling interrupts.
>
> I started with keyboard and it doesn't work.  The handler declaration:
>
>   procedure DOS_KbdHandler; interrupt;
>
> but compiler says:
>
>   keybrd.inc(14,29) Warning: Calling convention directive ignored:
>   "OldFPCCall"
>

This was fixed in trunk rev 39838 (
https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/pdecsub.pas?r1=39703=39838),
but so far the fix didn't make it into a release yet.  At least for AVR the
warning can be ignored. Not sure why your code doesn't work properly on
i8086 though.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Questions from Semi-Beginner

2021-02-20 Thread Christo Crause via fpc-pascal
On Sat, Feb 20, 2021 at 10:48 AM CSlemaker via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Title:  OS Upgrade Windows 7 to Windows 10 – Free Pascal Consequences ?
>
> I am currently running under Windows 7 but I MUST upgrade to Windows 10
> Pro.
> 
> Will I need to recompile my Pascal source files for object compatibility
> with Win 10?
> Should I install the latest version of Free Pascal, and if so, which
> version is that?
> Will I have any compatibility problems with my source codes and an
> up-to-date compiler?
>

The change in Windows version should in principle (yes, famous last words)
not impact on your legacy code.  There may be edge cases where permission
levels may change and prevent code from running.  That said I don't program
much on Windows.

Perhaps a bigger factor will be the changes in compiler behaviour. The
compiler team is serious about maintaining backwards compatibility, but
there are some breaking changes (not much really), see the following links:
https://wiki.freepascal.org/User_Changes_3.0
https://wiki.freepascal.org/User_Changes_3.2.0


> 
> P.S. - "Lazarus" is a term I'm not familiar with.  Is it a completely new
> IDE for Free
>Pascal?  Is there a document which describes differences with the old
> IDE?
>Is the old IDE still available in case I have trouble with Lazarus?
>

Lazarus is an independent IDE forFPC that has a graphical interface (a
Delphi IDE clone, somewhat similar to Visual Studio), perhaps a richer
feature set compared to FP and a visual form editor for visual editing of
graphical forms ("windows").  You can install and test it in parallel to
the old FP IDE, there isn't any interaction.  If you don't like Lazarus you
can continue working in FP. A couple of screen shots of Lazarus:
https://wiki.lazarus.freepascal.org/Screenshots
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Value:x:y syntax

2021-02-09 Thread Christo Crause via fpc-pascal
On Tue, Feb 9, 2021 at 2:11 PM Luis Henrique via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> At
> https://lists.freepascal.org/pipermail/fpc-devel/2021-February/043569.html
> I saw the syntax "value: x: y".
> > str(value:6:3, valuestr);
> What is the name of this and where is it documented?
> I did tests and saw that Y determines the width of the precision part, but
> I can't see any effect of X.
>

I guess one can call it optional formatting specifiers.  See documentation:
https://www.freepascal.org/docs-html/rtl/system/str.html
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] basic question on begin, end;

2020-09-23 Thread Christo Crause via fpc-pascal
On Wed, Sep 23, 2020 at 4:25 PM dano none via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> end;
> my_base := my_base + 15;
> writeln('current base ',my_base:2);
> ch := ReadKey;
> {  end;  { end i = column indexer }}
>

A different way to explain Bart's comment is that the inner loop over j is
a compound statement (between the inner loop begin/end block) which is
followed by more statements (the statements after the first end quoted
above).  If you comment out the outer begin/end block these statements are
not included in the execution of the outer loop, so for example my_base is
not incremented as part of the outer loop if the begin/end pair is
commented out as indicated in your example.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] bug tracker (bugs.freepascal.org) APPLICATION ERROR #400 (db connection failed)

2020-08-30 Thread Christo Crause via fpc-pascal
On Sun, Aug 30, 2020 at 11:26 AM Michael Van Canneyt via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

>
>
> On Sun, 30 Aug 2020, Christo Crause via fpc-pascal wrote:
>
> > On Sun, Aug 30, 2020 at 9:45 AM Dmitry Boyarintsev via fpc-pascal <
> > fpc-pascal@lists.freepascal.org> wrote:
> >
> >> The site opens up with:
> >>
> >> APPLICATION ERROR #400
> >>
> >
> > I also get the above mentioned error when trying to open the website.
>
> The problem should be fixed.
>

I confirm the bug tracker is available again.  Thank you Michael!
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] bug tracker (bugs.freepascal.org) APPLICATION ERROR #400 (db connection failed)

2020-08-30 Thread Christo Crause via fpc-pascal
On Sun, Aug 30, 2020 at 9:45 AM Dmitry Boyarintsev via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> The site opens up with:
>
> APPLICATION ERROR #400
>

I also get the above mentioned error when trying to open the website.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Using built-in serial instead of synaser and the like for Linux console app?

2020-08-21 Thread Christo Crause via fpc-pascal
On Fri, Aug 21, 2020 at 12:05 PM Bo Berglund via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> So hence my question:
> Is there something bad about serial (built-in to fpc) that makes it
> unsuitable for use?
>

In my limited experience the FPC serial unit is a bit more low level than
the components such as synaser etc.  There is a bit more of a learning
curve and one needs to decide whether to go blocking or not and how to
handle async reads etc.  I needed to use custom baud rates with auto baud
for an application (debugwire-gdb-bridge) so I took the time to figure out
some of the details.  Since then I've re-used it in other serial based
applications - once you get past the learning curve of how things fit
together it is relatively easy (I guess like most things).  I prefer it now
because it reduces external dependencies in a project.


> Seems like there are virtually no posts describing solutions using
> serial...
>

Here is a unit showing how to open, read and write (blocking) using the
serial unit:
https://github.com/ccrause/debugwire-gdb-bridge/blob/master/serialutils.pas
Unfortunately there is other code for sending a break command and setting
custom baud rates which makes it appear more complicated than it should be.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpDebug function-call proof-of-concept

2020-07-07 Thread Christo Crause via fpc-pascal
On Tue, 7 Jul 2020, 11:17 Joost van der Sluis,  wrote:

> Hi all,
>
> Last weekend I started on the ability to evaluate functions within
> fpDebug. And I got quite far. It is a proof-of-concept, still needs a
> lot of work. But it works!
>

Great news! I guess this is a step towards evaluating object properties via
get methods?

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Christo Crause via fpc-pascal
On Wed, May 13, 2020 at 9:31 AM Michael Van Canneyt 
wrote:

>
> On Wed, 13 May 2020, Christo Crause via fpc-pascal wrote:
>
> > On Tue, May 12, 2020 at 11:11 PM Noel Duffy via fpc-pascal <
> > fpc-pascal@lists.freepascal.org> wrote:
> >
> >> Sure, I can do that. I will look at creating a patch for this. For your
> >> purposes, do you prefer to have a new bug in the bug tracker opened for
> >> tracking this change?
> >>
> >
> > If your patch is related to an existing open bug report then keep
> updates,
> > discussions etc. under the same report, else the information gets
> > fragmented. A reporter cannot delete his/her own old patches, so just
> > append a version number to a new patch, if the patch completely replace a
> > previous patch, and mention the changes/updates in a comment. In your
> case
> > something like StrToHostAddr6-v2.patch for an updated patch.
>
> That is correct if you want to fix a wrong patch.
>
> But not what you should do for this case, because there are 2
> issues: fix existing api, and extend the existing api (a refactor).
>
> So: separate reports, and if so desired add a link in 'related to'.
>

Apologies, I should probably only comment if I followed all the details of
the discussion...
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Christo Crause via fpc-pascal
On Tue, May 12, 2020 at 11:11 PM Noel Duffy via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Sure, I can do that. I will look at creating a patch for this. For your
> purposes, do you prefer to have a new bug in the bug tracker opened for
> tracking this change?
>

If your patch is related to an existing open bug report then keep updates,
discussions etc. under the same report, else the information gets
fragmented. A reporter cannot delete his/her own old patches, so just
append a version number to a new patch, if the patch completely replace a
previous patch, and mention the changes/updates in a comment. In your case
something like StrToHostAddr6-v2.patch for an updated patch.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-06 Thread Christo Crause via fpc-pascal
On Wed, May 6, 2020 at 12:19 PM Noel Duffy via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> So I guess the question is, is it worth the effort to make
> StrToHostAddr6 RFC4291 compliant? Is that something the FPC team would
> want, or do they just not use the sockets unit?
>

There have been 2 changes applied to sockets.inc in the last two months so
it is not neglected.
I am convinced a patch to ensure compliance will be considered for
inclusion, especially if you
provide test cases demonstrating shortcomings in the current implementation.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Christo Crause via fpc-pascal
On Thu, 23 Apr 2020, 21:43 Ryan Joseph via fpc-pascal, <
fpc-pascal@lists.freepascal.org> wrote:

> ok, did this and now getting:
>
> /Users/ryanjoseph/Developer/lazarus/components/lazdebuggergdbmi/gdbmidebugger.pp(63,16)
> Fatal: (10022) Can't find unit PropEdits used by GDBMIDebugger
>
> svn up says "At revision 63051."
>
> Never an easy time building lazarus for me. :)
>
> Regards,
> Ryan Joseph
>

I usually revert to brute force troubleshooting in these instances: pass -
va to the compiler. A lot of information, but usually the problem is close
to the end so scanning the output in reverse should often reveal what is
wrong.

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] About fpc license.

2020-04-09 Thread Christo Crause via fpc-pascal
On Fri, 10 Apr 2020, 05:09 fredvs via fpc-pascal, <
fpc-pascal@lists.freepascal.org> wrote:

> Hello.
>
> I have done a fork of fpc fixes_3_2 and made some modification of original
> code.
>
> May I distribute the fpc binary of that patched version with the units
> files, ready to use out-of-the-box?
>

In my opinion yes,  but note I only represent my own opinion here. On a
practical side, make sure that your users know they are downloading a
custom patched version not supported by the fpc team.


Must I add the source of the change done?
>

As a minimum clearly display a download link to the modified source in the
download. Could be a separate text file in the download, perhaps listing
the modifications and link to the source.

I What I am not allowed to do?
>

Anything not permitted by fpc's licences :)

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to rebuild an fpc package

2020-02-11 Thread Christo Crause via fpc-pascal
On Tue, Feb 11, 2020 at 4:57 PM Luis - SoftSAT Sistemas <
l...@softsatsistemas.com.br> wrote:

> > You are using relative paths in -Fu and your current folder is
> c:\lazarus\fpc\3.0.4\source\packages\fcl-db, so
> > -Fu../../rtl should expand to -Fuc:\lazarus\fpc\3.0.4\source\rtl - the
> compiler is searching where it was told.
> This is done by the make file that come with the package.
>
> > It may be easier to just specify the absolute path to the compiled RTL
> units, for example:
> > -Fuc:\lazarus\fpc\3.0.4\units\rtl\your-target
> If i add this with `make OPT=-Fu` it advances to next error and
> require another unit.
>
> >> C:/lazarus/fpc/3.0.4/bin/i386-win32/ppc386.exe fpmake.pp -n -Fu../../r
> if i edit the make file and remove the "-n" flag it compiles the fpmake
> but when fpmake is run its throws another error.
>
> Anyway, looks like there are some problem with the makefile or with
> something else on my system.
>

I guess the problem is how to tell the make system when to use installed
units and when to recompile units.  Although it should be possible to
figure out how to do this, I rather suggest an easier fix: just recompile
everything with "make all install" from the base of the fpc source folder.
This way the makefiles do all the tracking of where compiled units are.
The few minutes this will take should be much less than the time spent
trying to figure out how to fix your original problem.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to rebuild an fpc package

2020-02-11 Thread Christo Crause via fpc-pascal
On Tue, Feb 11, 2020 at 3:23 PM Luis - SoftSAT Sistemas via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Looking at unit search path the compiler are looking at "sources" dir
> instead of "units" dir with the compiled units and i dont know how to fix
> this.
>
> C:\lazarus\fpc\3.0.4\source\packages\fcl-db>make all OPT=-vut
> C:/lazarus/fpc/3.0.4/bin/i386-win32/ppc386.exe fpmake.pp -n -Fu../../r
> tl -Fu../../packages/paszlib -Fu../../packages/fcl-process
> -Fu../../packages/has
> h -Fu../../packages/libtar -Fu../../packages/fpmkunit  -vut
>

You are using relative paths in -Fu and your current folder is
c:\lazarus\fpc\3.0.4\source\packages\fcl-db, so
-Fu../../rtl should expand to -Fuc:\lazarus\fpc\3.0.4\source\rtl - the
compiler is searching where it was told.

It may be easier to just specify the absolute path to the compiled RTL
units, for example:
-Fuc:\lazarus\fpc\3.0.4\units\rtl\your-target
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal