Re: Does FreeRTOS works on Linux?

2021-05-11 Thread loïc tourlonias
On Tue, May 11, 2021 at 5:44 AM Valdis Klētnieks
 wrote:
>
> On Sun, 09 May 2021 08:40:56 +0200, loïc tourlonias said:
>
> > related to our architecture. We are working on a ARM Cortex-A7 which
> > have an isolation between a normal world and a secure world. Linux is
> > working on the normal world for the UI and FreeRTOS is running on the
> > secure world.
>
> Is there an easily comprehensible explanation of how that whole ARM 
> normal/secure
> stuff is supposed to work?
I'll try to explain shortly. On ARM Cortex-A family, the core has two
isolated worlds (normal/secure). The two worlds have their own context
(register, stack ...) and the normal world have less privileges than
the secure world.
The core starts in the secure world and the secure software configures
the context of the normal world before giving the execution to the
normal world with a specific ARM instruction SMC 0.

The communication between normal and secure worlds is done through
SMC. When the normal world requires privileged access (secure clock
configuration for example), it askes the secure world the access by
calling a SMC instruction (with a specific ID), then a SMC exception
is triggered in the secure context. The secure monitor catches this
exception and handles it before returning to the normal world.

I haven't found any block diagram or data flow to explain this.
I've only found some useful links from ARM community:
https://www.microcontrollertips.com/embedded-security-brief-arm-trustzone-explained/
https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/architecting-more-secure-world-with-isolation-and-virtualization

HTH

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Does FreeRTOS works on Linux?

2021-05-09 Thread loïc tourlonias
> if using a posix thread full fills the requirement of RTOS. The reason
> I want to use RTOS is , I am porting a Microcontroller code using RTOS
> (free RTOS) to Linux and
> afaik FreeRTOS doesnt work on Linux.
> > FreeRTOS is a standalone OS and depending on your system there may be
> > an example running on your architecture in parallel of your embedded
> > Linux. For example, on one of my project with have an ARM Cortex-A7
> > with Linux running in Normal World and FreeRTOS running in Trusted
> > world.
> This is interesting , do you have something to share?
Sorry, this is intellectual property from my company so I can't share
source code but we have started from the FreeRTOS porting sample
related to our architecture. We are working on a ARM Cortex-A7 which
have an isolation between a normal world and a secure world. Linux is
working on the normal world for the UI and FreeRTOS is running on the
secure world. Communication between the two worlds is made by SMC.

Regards
Loïc

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Does FreeRTOS works on Linux?

2021-05-05 Thread loïc tourlonias
On Wed, May 5, 2021 at 8:07 PM Raul Piper  wrote:
>
> Hello,
Hi
> I am having an embedded linux system and wanted to use any  RTOS on
> it. Can I use Free RTOS?
> My project has 2 tasks , one is producer and another is consumer
> working parallely.
I'm afraid I don't understand what you are requesting and I hope that
someone else understand more clearly. But I'll still explain my
understanding.
You want to run a RTOS upon Linux OS, doesn't make it too much OSes?
Then I have several questions:
Do you really need a Real Time Operating System, can't you run your
project in Linux userspace?
Have you tried Linux RTOS extension (again I'm no expert and haven't
tried them but you can look at Xenomai)?
FreeRTOS is a standalone OS and depending on your system there may be
an example running on your architecture in parallel of your embedded
Linux. For example, on one of my project with have an ARM Cortex-A7
with a Linux running in Normal World and FreeRTOS running in Trusted
world.
>
> I have seen Free RTOS used in microcontrollers handling this , how can
> this be done in Linux(which such APIs if not Free RTOS).
>
HTH
> Regards,
> R
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: high precision timers

2021-05-03 Thread loïc tourlonias
Hi

On Mon, May 3, 2021 at 2:16 PM Hyeonggon Yoo <42.hye...@gmail.com> wrote:

> Greg, and Valdis Thank you so much! It helped a lot!
>
> I thought there would be a way to do it because of high resolution.
>
> 2021년 5월 3일 (월) 오후 8:13, Valdis Klētnieks 님이 작성:
>
>> On Mon, 03 May 2021 00:56:17 +0900, Hyeonggon Yoo said:
>>
>> > I mean, is there an API that guarantees high precision (non architecture
>> > dependent way)
>>
>> How do you guarantee high precision if you're on hardware that doesn't
>> provide a high precision/resolution timer?
>>
>
If you don't have any hardware support, the Linux kernel can't magically
count faster than its system tick. ^^


> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: [OSSNA] Intro to kernel hacking tutorial

2019-07-05 Thread loïc tourlonias
Hi,

On Fri, Jul 5, 2019 at 4:51 AM Tobin C. Harding  wrote:
>
> Hi,
>
> I am doing a tutorial at OSSNA in San Diego on getting into kernel
> hacking.  I'm only a couple of years deep into kernel hacking so I
> wanted to reach out to those more experienced than myself (and those
> less experienced).
>
> Is there any thing that you would really like to see covered in this
> tutorial?
>
I'm not involved in kernel hacking, but I've tried several times to
start writing patches. Because of time sharing issue I haven't get to
the end but a tutorial will be great.
The question I've asked me during my several tries is where can I be
useful (which topics, what I'm confident enough in to play with...).

Looking in drivers/staging wasn't any help in my case and making
kernel janitor is useful but not very well viewed as I've heard.

So I think that digging further in your tutorial on several ways to
start kernel hacking may be interesting.

> Current format/content: the tutorial will attempt to bridge the gap in
> the learning process between the 'first patch' page on kernelnewbies.org
> wiki and being 'comfortable' patching the kernel via LKML.  Outcome will
> (hopefully) be a small patch set into drivers/staging/.  (Don't worry
> Greg only one group got to this stage last time, you won't get flooded
> with patches :)
>

HTH and very enthusiast to read this tutorial.
Loïc

> Thanks,
> Tobin.
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: What does the "-DPACKAGE" means?

2018-07-11 Thread loïc tourlonias
Hi

On Wed, Jul 11, 2018 at 10:08 AM, Dengke Du  wrote:
>
> Hi all
>
> What does the "-DPACKAGE" means?
> ```
> $(OUTPUT)test-libbfd.bin:
> $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
> ```
> In this link:
> https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/tree/tools/build/feature/Makefile?id=fb982666e380c1632a74495b68b3c33a66e76430#n189

If you look at the manpage of gcc, the -D option is used to define
macro. It creates new #define during build.

HTH
Loïc
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: serial: start_tx & buffer handling

2018-05-04 Thread loïc tourlonias
 Hi

 On Fri, May 4, 2018 at 6:31 AM, Muni Sekhar  wrote:
>>
>> On Fri, May 4, 2018 at 12:04 AM, Greg KH  wrote:
>> > On Thu, May 03, 2018 at 08:08:48PM +0530, Muni Sekhar wrote:
>> >> Hi All,
>> >>
>> >> I’m trying to understand how user mode buffer is written to low level
>> >> serial hardware registers.
>> >>
>> >> For this I read the kernel code and I came to know that from user mode
>> >> write() API lands into kernel’s tty_write() ("drivers/tty/tty_io.c")
>> >> and then it calls a uart_write() ("drivers/tty/serial/serial_core.c").
>> >>
>> >> In uart_write(), the buffer is copied to circ_buf and then it calls
>> >> low level serial hardware driver’s start_tx() (struct uart_ops
>> >> .start_tx). But here I could not find how the buffer kept in circ_buf
>> >> is copied to serial port’s TX_FIFO registers?
>> >>
>> >> Can someone take a moment to explain me on this?
>> >
>> > It all depends on which specific UART driver you are looking at, they
>> > all do it a bit different depending on the hardware.
>> >
>> > Which one are you looking at?  Look at what the start_tx callback does
>> > for that specific driver, that should give you a hint as to how data
>> > starts flowing.  Usually an interrupt is enabled that is used to flush
>> > the buffer out to the hardware.
>> >
>>
>> I’m looking for any existing sample code which does DMA transfers of
>> UART transmitted data. I looked at the bcm63xx_uart.c, it looks it
>> does not handle DMA transfers. Even copying the Tx buffer (from
>> circ_buf) to UART_FIFO_REG happening in ISR.


 You can have a look at atmel_serial kernel module (built for ARM).
 
https://elixir.bootlin.com/linux/latest/source/drivers/tty/serial/atmel_serial.c

 The dma buffer is linked to uart circular buffer in prepare_tx() function
 called from uart_startup(). It's released in release_tx() function called
 from uart_shutdown(). DMA buffer is managed in schedule_tx() function called
 from a tasklet triggered by the ISR.

 HTH

>>
>>
>> > thanks,
>> >
>> > greg k-h
>>
>>
>>
>> --
>> Thanks,
>> Sekhar
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: serial: start_tx & buffer handling

2018-05-04 Thread loïc tourlonias
Hi

On Fri, May 4, 2018 at 6:31 AM, Muni Sekhar  wrote:

> On Fri, May 4, 2018 at 12:04 AM, Greg KH  wrote:
> > On Thu, May 03, 2018 at 08:08:48PM +0530, Muni Sekhar wrote:
> >> Hi All,
> >>
> >> I’m trying to understand how user mode buffer is written to low level
> >> serial hardware registers.
> >>
> >> For this I read the kernel code and I came to know that from user mode
> >> write() API lands into kernel’s tty_write() ("drivers/tty/tty_io.c")
> >> and then it calls a uart_write() ("drivers/tty/serial/serial_core.c").
> >>
> >> In uart_write(), the buffer is copied to circ_buf and then it calls
> >> low level serial hardware driver’s start_tx() (struct uart_ops
> >> .start_tx). But here I could not find how the buffer kept in circ_buf
> >> is copied to serial port’s TX_FIFO registers?
> >>
> >> Can someone take a moment to explain me on this?
> >
> > It all depends on which specific UART driver you are looking at, they
> > all do it a bit different depending on the hardware.
> >
> > Which one are you looking at?  Look at what the start_tx callback does
> > for that specific driver, that should give you a hint as to how data
> > starts flowing.  Usually an interrupt is enabled that is used to flush
> > the buffer out to the hardware.
> >
>
> I’m looking for any existing sample code which does DMA transfers of
> UART transmitted data. I looked at the bcm63xx_uart.c, it looks it
> does not handle DMA transfers. Even copying the Tx buffer (from
> circ_buf) to UART_FIFO_REG happening in ISR.
>

You can have a look at atmel_serial kernel module (built for ARM).
https://elixir.bootlin.com/linux/latest/source/drivers/tty/serial/atmel_serial.c

The dma buffer is linked to uart circular buffer in prepare_tx() function
called from uart_startup(). It's released in release_tx() function called
from uart_shutdown(). DMA buffer is managed in schedule_tx() function
called from a tasklet triggered by the ISR.

HTH

>
>
> > thanks,
> >
> > greg k-h
>
>
>
> --
> Thanks,
> Sekhar
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Want some help for starting contribution to linux-kernel projects

2017-08-25 Thread loïc tourlonias
On Thu, Aug 24, 2017 at 9:52 PM, Harsha Sharma 
wrote:
> Hi,
> Thanks for reply.
> I am submitting some cleanup patches for now.
> I will like to solve some beginner issues. Where can I find such issues or
> bug-lists?

I'm not an expert, I've tried it myself but never achieved the first patch
;).
First, you can follow this First kernel patch tutorial


Then, you have several options:
- work on staging drivers (drivers in staging with a TODO list)
- participate to the kernel janitors project (or another project).

HTH,

> Thanks.
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Want some help for starting contribution to linux-kernel projects

2017-08-24 Thread loïc tourlonias
On Tue, Aug 22, 2017 at 8:19 PM, Harsha Sharma 
wrote:

Hi,


> hello! I am trying to fix some of bugs from
>
https://bugzilla.kernel.org/buglist.cgi?component=man-pages_id=959835=Documentation=---
> but where to make the required changes.
> Can anyone please tell what bugs I can start fixing to contribute in
> linux-kernel projects??

Have you tried to look at the kernelnewbies site (https://kernelnewbies.org/)?
I don't know if it speaks about how to use bugzilla but there is a full
topic on how to contribute.

> I am comfortable in C programming and linux-command line
> Please help .
> I am really looking forward to this.
>

HTH

> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Load partially USB composite device

2017-08-09 Thread loïc tourlonias
On Wed, Aug 9, 2017 at 10:15 AM, Bjørn Mork <bj...@mork.no> wrote:
> loïc tourlonias <loic.tourlon...@gmail.com> writes:
>> On Wed, Aug 9, 2017 at 9:25 AM, Bjørn Mork <bj...@mork.no> wrote:
>>
>>> Sounds like your system has other issues, but whatever...
>>
>> I may not have been clear in my explanation. What seems wrong with my system?
>
> "ethXX which interferes with a service". It should not.

Agreed, but fixing our service is really complex, that's why I'm
looking for a simple solution for this specific device before we have
the resource to fix the service.
>
>>> The cdc_ether driver treats any ID entry with .driver_info = 0 as a
>>> blacklist entry.  So you can dynamically blacklist devices by writing
>>> the "VID PID" to /sys/bus/usb/drivers/cdc_ether/new_id before the device
>>> is probed.
>>>
>> I have tried this and look at the source code of
>> driver/usb/core/driver.c. But I think this is not what I required.
>> What I understand is that the new_id file is used to dynamically add
>> new USB id to the cdc_ether driver.
>
> True.  But as I said: The cdc_ether driver use the device ID list for
> blacklisting. This is an implementation detail specific to this driver.
> It will use the .driver_info field as a pointer to usbnet specific data.
> But if the field is 0, then the entry becomes a blacklist entry instead.
>
> Dynamically added entries have all fields set to 0 by default, and will
> also be tried before the built-in entries (since v3.15). So adding a
> dynamic entry to the cdc_ether driver means adding a blacklist entry
> (Unless you explicitly reference an existing entry for inheritance).
>
> Try it.
>
I have (finally) understood how it works and I will try it a little
bit harder and try to figure out why my first attempts doesn't work as
expected.

Thanks
Loic
>
> Bjørn

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Load partially USB composite device

2017-08-09 Thread loïc tourlonias
On Wed, Aug 9, 2017 at 9:25 AM, Bjørn Mork <bj...@mork.no> wrote:
> loïc tourlonias <loic.tourlon...@gmail.com> writes:

Thank's for the quick response

>
>> Hi everybody,
>>
>> In my project I have an USB composite device (a LTE modem) which use
>> USB to communicate with the processor. This device has several
>> interface to communicate but I do not use all of them. In particular,
>> it loads cdc_ether device which I don't use and I have an undesired
>> ethXX which interferes with a service in my system.
>
> Sounds like your system has other issues, but whatever...

I may not have been clear in my explanation. What seems wrong with my system?

>
>> To schematize, let's say my device is loaded on port 2 of usb1, I have
>> the following USB topology:
>> - 1-2:1.0: tty
>> - 1-2:1.1: tty
>> - 1-2:1.2: tty
>> - 1-2:1.3: tty
>> - 1-2:1.4: tty
>> - 1-2:1.5: eth (not desired)
>>
>> Is there a way to prevent this specific ethXX to mount?
>>
>> I've already tried to create a udev rules, but I don't manage to stop
>> the loading process.
>> Here is a summary of my tries:
>> 1/ I couldn't use the /sys/bus/usb1/.../1-2/activated file in my udev
>> rule because it's an USB composite device and I want to use the tty
>> interfaces but not the eth interface
>>
>> 2/ I have tried to stop the udev loading process, but setting MODALIAS
>> environment variable to a NULL-string doesn(t do the trick and
>> last-rule udev option has been removed in my udev version (1.8.2).
>>
>> 3/ I have tried to create a custom environment variable IGNORE_ETH and
>> modify my last rule which run modprobe with the modalias variable. In
>> the logs I see that modprobe isn't called by udev rules, but the
>> cdc_ether device is loaded all the same.
>>
>> 4/ I have think of creating a stub cdc_ether driver and use the
>> /etc/modprobe.d/my_file.conf to preempt the loading for my specific
>> usb composite device but this solution is ugly and I'm not sure it
>> will work.
>
> The cdc_ether driver treats any ID entry with .driver_info = 0 as a
> blacklist entry.  So you can dynamically blacklist devices by writing
> the "VID PID" to /sys/bus/usb/drivers/cdc_ether/new_id before the device
> is probed.
>
I have tried this and look at the source code of
driver/usb/core/driver.c. But I think this is not what I required.
What I understand is that the new_id file is used to dynamically add
new USB id to the cdc_ether driver.
What I want is the opposite, currently my device is loaded with
cdc_ether.ko and I want this device to remain unloaded.

Furthermore, after sending this email I have thought of renaming my
device in an udev rule. But unfortunately, it passed by an eth0 state
which I want to get rid of.

>
> Bjørn

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Load partially USB composite device

2017-08-08 Thread loïc tourlonias
Hi everybody,

In my project I have an USB composite device (a LTE modem) which use
USB to communicate with the processor. This device has several
interface to communicate but I do not use all of them. In particular,
it loads cdc_ether device which I don't use and I have an undesired
ethXX which interferes with a service in my system.

To schematize, let's say my device is loaded on port 2 of usb1, I have
the following USB topology:
- 1-2:1.0: tty
- 1-2:1.1: tty
- 1-2:1.2: tty
- 1-2:1.3: tty
- 1-2:1.4: tty
- 1-2:1.5: eth (not desired)

Is there a way to prevent this specific ethXX to mount?

I've already tried to create a udev rules, but I don't manage to stop
the loading process.
Here is a summary of my tries:
1/ I couldn't use the /sys/bus/usb1/.../1-2/activated file in my udev
rule because it's an USB composite device and I want to use the tty
interfaces but not the eth interface

2/ I have tried to stop the udev loading process, but setting MODALIAS
environment variable to a NULL-string doesn(t do the trick and
last-rule udev option has been removed in my udev version (1.8.2).

3/ I have tried to create a custom environment variable IGNORE_ETH and
modify my last rule which run modprobe with the modalias variable. In
the logs I see that modprobe isn't called by udev rules, but the
cdc_ether device is loaded all the same.

4/ I have think of creating a stub cdc_ether driver and use the
/etc/modprobe.d/my_file.conf to preempt the loading for my specific
usb composite device but this solution is ugly and I'm not sure it
will work.

Any idea will be great.
Best Regads
Loic

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: cross compiling

2017-05-31 Thread loïc tourlonias
Hi

On Wed, May 31, 2017 at 12:21 AM, juan pedro meriño 
wrote:

> Toolchin for compiler linux?
>
 Take a look at this page of kernelnewbies
https://kernelnewbies.org/FAQ/KernelCrossCompilation

BR
Loïc

> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies