Date   

bt_gatt_is_subscribed - any examples?

Lawrence King
 

Dear All:

 

I have a similar problem to what Frank Viren is seeing in his thread “bt_gatt_notify multiple characteristics”. How to determine the pointer to the right characteristic.

 

When my central connects to my device I want to send it several notifications. My device has several characteristics under the primary service. When the central connects (in this case the central is either an iPhone, or an Android phone), if I simply wait 200mS after the connection and sent the notifications with bt_gatt_notify() it ‘almost’ always works. Unfortunately sometimes Android or iOS take a little longer to subscribe for notifications, hence I would like to determine if the phone is ready to receive notifications rather than simply waiting 200mS.

 

I hunted through the bt_ apis and found bt_gatt_is_subscribed() which looks like I can loop testing to see if the central is ready and then send the notifications. Much better than blindly waiting 200mS.

 

 

bool bt_gatt_is_subscribed(struct bt_conn *connconststructbt_gatt_attr *attr, u16_t ccc_value)

Check if connection have subscribed to attribute.

Check if connection has subscribed to attribute value change.

The attribute object can be the so called Characteristic Declaration, which is usually declared with BT_GATT_CHARACTERISTIC followed by BT_GATT_CCC, or the Characteristic Value Declaration which is automatically created after the Characteristic Declaration when using BT_GATT_CHARACTERISTIC, or the Client Characteristic Configuration Descriptor (CCCD) which is created by BT_GATT_CCC.

Return

true if the attribute object has been subscribed.

Parameters

·        conn: Connection object.

·        attr: Attribute object.

·        ccc_value: The subscription type, either notifications or indications.

 

OK, based on the documentation, this seems to be what I want, but the parameters are difficult for a newbie to understand:

conn – yes I did declare this with BT_GATT_CHARACTERISTIC I know where it is in my source code, but how do I find a pointer to it?

attr –  this was automatically created with BT_GATT_CCC in the same place, but again how do I get a pointer to the attr?

ccc_value – this is obviously an int, probably with definitions for the bits, but what symbolic enums or defines can I put in this parameter?

 

 

 

Unfortunately a google search of “bt_gatt_is_subscribed” only finds 8 results, the source code, the documentation (on the zephyr site, and on the nordic site), and 2 content aggregators. I did not find a single piece of code that calls this function, but there must be at least one call to the function in at least some test suite. bt_gatt_is_subscribed is never called in any of the zephyr/samples…

 

Can someone point me to an example please?

 

 

 

Lawrence King

Principal Developer

Connected Transport Market Unit

https://www.Irdeto.com

+1(416)627-7302

 

1  2 - linkedin  3 - instagram  4 - youtube  6 - facebook  7

            

CONFIDENTIAL: This e-mail and any attachments are confidential and intended solely for the use of the individual(s) to whom it is addressed. It can contain proprietary confidential information and be subject to legal privilege and/or subject to a non-disclosure Agreement. Unauthorized use, disclosure or copying is strictly prohibited. If you are not the/an addressee and are in possession of this e-mail, please delete the message and notify us immediately. Please consider the environment before printing this e-mail. Thank you.

 

 

 


Determining source of GPIO Interrupt on NRF52832 #gpio #nrf52832

bbradley@...
 

Hello, 

I hope I am posting this question in the correct place.

I have an interrupt handler which can be configured to trigger on either edge. This is working perfectly, but I want to perform a different action on a rising edge vs a falling edge in some cases. Is there any way to do this? (i.e., perhaps I can determine in the interrupt context that a rising edge and not a falling edge was triggered?)

I am configuring the interrupts and registering the handler using the gpio API (gpio_pin_configure, gpio_init_callback, gpio_add_callback, gpio_pin_enable_callback), but the interrupt handler will act differently on a rising edge vs falling edge, for instance, so it is helpful to know which specific flags were raised that triggered the interrupt. I am currently using the gpio_pin_read API to work around this, but I am not sure if this is the best solution.

In other MCU's there is often an API to read the status register containing the interrupt flags that have been raised, and then an API for clearing the status register after reading. Is there anything similar with Zephyr? Or perhaps there is a way to have two different handlers for rising edge/falling edge?

I am using Zephyr v2.0.99 right now.

Thanks for any help, 
Brian


Re: Adafruit Trinket M0: west flash > How to? #flash #west

William Fish
 

I have downloaded the Arduino IDE and that includes a version of BOSSAC that may be useful. That may be a quickest method to find a working replacement version.

My interest in the use of bossac comes from the release of the Arduino Nano 33 BLE (Sense) as they are based on nRF52840 with a special boot-loader designed to work in the arduino environment.

I am looking to see if it is possible to use zephyr on these boards without having to replace the boot-loader which may not be possible. I do know that the boot-loader can easily be replacement via the debug interface pins on the underside of these board but that's not that useful for most people.

Billy..


Re: Adafruit Trinket M0: west flash > How to? #flash #west

@yasokada
 

I have checked old SDKs.

SDK v0.9.2 (20 Oct 2017): no "-o" option for bossac.
SDK v0.9.1 (20 May 2017): no "-o" option for bossac.

The "-o" for bossac.py is added on 9 Jul 2018
https://github.com/zephyrproject-rtos/zephyr/commit/bde3224c911176a6af4fa60a067c7492dfc76fe4

I just wonder which environment they did check.

It may be possible to replace bossac binary with "-o" option, but I am not sure whether it is best way for Zephyr.
I will just check further information myself, but for a while, I give up using Adafruit Trinket M0 and will use other boards.


Re: Adafruit Trinket M0: west flash > How to? #flash #west

Bolivar, Marti
 

Hi Yas,

"yasokada via Lists.Zephyrproject.Org"
<yasokada=gmail.com@...> writes:

Dear Marti

Thank you very much for taking your time for this.
From your information, it seems the bossac has "-o" options in source
code, but does not have in binary execution code.
Correct -- where the binary in question is the one provided with the
SDK.


I would try compiling bossac from source trying that version. Please
consider filing a bug against the Zephyr SDK about the missing option if
that solves your issue.
I will see.

From your information again, it seems the Adafruit Trinket M0 is
unmaintained.
It may be unmaintained. I am not sure :).

Updating the SDK somehow broke the condition to compile
and flash the Trinket M0 in current SDK version.
This I'm not sure about either. I don't know if anybody was actively
testing this with the SDK in previous versions. I just meant by this
that if nobody is actively maintaining this, you may have to figure this
issue out for yourself, unfortunately.

Best,
Marti


I will check how to solve this.


Re: Adafruit Trinket M0: west flash > How to? #flash #west

@yasokada
 

Dear Marti


Thank you very much for taking your time for this.
From your information, it seems the bossac has "-o" options in source code, but does not have in binary execution code.

> I would try compiling bossac from source trying that version. Please
> consider filing a bug against the Zephyr SDK about the missing option if
> that solves your issue.

I will see.

From your information again, it seems the Adafruit Trinket M0 is unmaintained. Updating the SDK somehow broke the condition to compile and flash the Trinket M0 in current SDK version.

I will check how to solve this.


BBC-Microbit GPIO Mesh demo #bluetooth #nrf51822 #zephyrbluetoothmesh #sensor #ble

Daniel Fox <danny.fox97@...>
 

Hi im a beginner trying to work with the bbc microbits for my engineering project, my task involves using mesh networking on the bbc microbits to send a message to the user's computer stating motion is detected by a PIR motion sensor.
Im currently building off the demo as all I need is to change the button press to read the GPIO pin which the motion sensor will be hooked up to on the board. Then as the motion is detected it will act as if the button has been pressed like in the mesh demo and send a message to the other devices on the network.
My current problem is that the program only reads the connection pin and switches to a 1 instead of 0, it doesn't react to motion from the sensor.It is switching between 0 and 1 while the cable is connected to the GPIO pin.
Can someone please help I cannot get this to work , I have also tried the button examples and the GPIO examples on zephyr.

snippets of code taken from mesh_demo
#define PIR EXT_P0_GPIO_PIN
 
static struct device *gpio;
static struct device *nvm;
static struct device *pwm;
 
static struct k_work button_work;
static void button_send_pressed(struct k_work *work)
{
printk("button_send_pressed()\n");
board_button_1_pressed();
}
 
static void button_pressed(struct device *dev, struct gpio_callback *cb,
   u32_t pins)
{
struct mb_display *disp = mb_display_get();
 
if (pins & BIT(SW0_GPIO_PIN)) {
k_work_submit(&button_work);
} else {
u16_t target = board_set_target();
 
if (target > 0x0009) {
mb_display_print(disp, MB_DISPLAY_MODE_SINGLE,
K_SECONDS(2), "A");
} else {
mb_display_print(disp, MB_DISPLAY_MODE_SINGLE,
K_SECONDS(2), "%X", (target & 0xf));
}
}
}
static void configure_button(void)
{
 
static struct gpio_callback button_cb;
k_work_init(&button_work, button_send_pressed);
 
gpio = device_get_binding(SW0_GPIO_CONTROLLER);
 
gpio_pin_configure(gpio, PIR ,
   (GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
    GPIO_INT_ACTIVE_HIGH|
  GPIO_INT_DEBOUNCE | GPIO_PUD_PULL_UP));
gpio_pin_configure(gpio, SW1_GPIO_PIN,
   (GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
    GPIO_INT_ACTIVE_LOW));
 
gpio_init_callback(&button_cb, button_pressed,
   BIT(PIR ) | BIT(SW1_GPIO_PIN));
gpio_add_callback(gpio, &button_cb);
 
gpio_pin_enable_callback(gpio, PIR );
gpio_pin_enable_callback(gpio, SW1_GPIO_PIN);
while (1) {
u32_t val=1;
int ret;
printk("toggling pin %d\n", PIR );
ret = gpio_pin_read(gpio, PIR , &val);
if (ret) {
printk("error %d\n",PIR );
}
if (val){
val=0;
}else {
val=1;
 
}
printk("VALUE pin %d\n", val);
k_sleep(100);
}
 
Any help would be great, my main issue is the fact I can't get the microbit board to react to the motion sensor when motion is detected.


Re: Adafruit Trinket M0: west flash > How to? #flash #west

Bolivar, Marti
 

Hi Yas,

"yasokada via Lists.Zephyrproject.Org"
<yasokada=gmail.com@...> writes:

[Edited Message Follows]

Dear Marti and William

Thank you for your reply.

I tried using " --bossac-port", but still have problem about "-o" option.

I checked my bossac option by
```
$ ~/Zephyr_191116/zephyr-sdk-0.10.3/sysroots/x86_64-pokysdk-linux/usr/bin/bossac --help
```

```
Usage: bossac [OPTION...] [FILE]
Basic Open Source SAM-BA Application (BOSSA) Version 1.7.0
Flash programmer for Atmel SAM devices.
...
```

There is no "-o" option for my bossac.
My environment is Ubuntu 18.04 LTS.
I checked the bossac source code and the option seems to be available,
so it doesn't look like there's a problem with the bossac.py code in the
zephyr repository that is using --offset:

https://github.com/shumatech/BOSSA/blob/master/src/bossac.cpp#L185

I'm not sure why the bossac that ships with the Zephyr SDK doesn't have
the --offset option. I checked the version that ships with bossa-cli on
Ubuntu 18.04 and it doesn't seem to have it either, as you say.

I would try compiling bossac from source trying that version. Please
consider filing a bug against the Zephyr SDK about the missing option if
that solves your issue.


I have found this.
Adafruit Trinket M0 Bossac Offset is Wrong #16052
https://github.com/zephyrproject-rtos/zephyr/issues/16052

For Adafruit Trinket M0, the address is specified using "-o 0x2000". However, because my bossac does not have "-o" option, the problem occurs.
It seems that I have to update my environment to have newer? bossac
version.
By the way, it looks like the person who added this board in commit
4f9864b15b263dcf7d6e204ac79f3d96a8a30e64 is no longer active on Zephyr
(the last contribution they made is from March 2018), so it's possible
that this board is unmaintained.

Hope you figure out your issue.

Thanks,
Marti



Interfacing Max44009 sensor with nrf52840 custom board #nrf52480 #sensor

amore@...
 

My environment : Debian 10
zephyr SDK 0.10.3
zephyr 2.1.0-rc2

I'm Interfacing Max44009 with nrf52840 on a custom make board in zephyr. I'm using the sample sensor program for MAX44009. Configured with appropriate overlay and prof.conf according to the MAX44009 datasheet . After flashing I'm getting Illegal use of ESPR on serial console.
 
I can't seem to figure why this is happening as i'm not majorly modifying with the sample code.
Please suggest debugging .
Thanks in advance.


API meeting: Agenda

Carles Cufi
 

Hi all,

This week we will focus on GPIO:

- GPIO: Update on progress
- Look at the PRs with driver conversion (https://github.com/zephyrproject-rtos/zephyr/issues/18530)
- Check users of GPIO APIs: https://github.com/zephyrproject-rtos/zephyr/issues/20017
- Tips for converting users can be found here: https://github.com/zephyrproject-rtos/zephyr/issues/20017#issuecomment-549315497 (thanks Peter!)
- Any additional outstanding PRs to topic-gpio

Additional items in the "Triage" column in the GitHub project may be discussed if time permits.
If you want an item included in the meeting, please add it to the GitHub project.

https://github.com/zephyrproject-rtos/zephyr/wiki/Zephyr-Committee-and-Working-Group-Meetings#zephyr-api-discussion
https://github.com/zephyrproject-rtos/zephyr/projects/18
https://docs.google.com/document/d/1lv-8B5QE2m4FjBcvfqAXFIgQfW5oz6306zJ7GIZIWCk/edit

Regards,

Carles


Re: Adafruit Trinket M0: west flash > How to? #flash #west

@yasokada
 
Edited

Dear Marti and William

Thank you for your reply.

I tried using "--bossac-port", but still have problem about "-o" option.

I checked my bossac option by
```
$ ~/Zephyr_191116/zephyr-sdk-0.10.3/sysroots/x86_64-pokysdk-linux/usr/bin/bossac --help
```

```
Usage: bossac [OPTION...] [FILE]
Basic Open Source SAM-BA Application (BOSSA) Version 1.7.0
Flash programmer for Atmel SAM devices.
...
```

There is no "-o" option for my bossac.
My environment is Ubuntu 18.04 LTS.

I have found this.
Adafruit Trinket M0 Bossac Offset is Wrong #16052
https://github.com/zephyrproject-rtos/zephyr/issues/16052

For Adafruit Trinket M0, the address is specified using "-o 0x2000". However, because my bossac does not have "-o" option, the problem occurs.
It seems that I have to update my environment to have newer? bossac version.


cannot flash zephyr on stm32_min_dev_blue #stm32 #flash

moreaniket219@...
 

ninja flash
[0/1] Flashing stm32_min_dev_blue
-- west flash: using runner openocd
-- runners.openocd: Flashing file: /home/amore/zephyrproject/zephyr/samples/basic/blinky/build/zephyr/zephyr.hex
Open On-Chip Debugger 0.10.0+dev-00992-g3333261df-dirty (2019-08-16-00:14)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : clock speed 1000 kHz
Info : STLINK V2J31S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.259867
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State      
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f1x.cpu       hla_target little stm32f1x.cpu       unknown
Error: mem2array: Read @ 0xe0042004, w=4, cnt=1, failed
/home/amore/zephyr-sdk-0.10.3/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/mem_helper.tcl:6: Error:
in procedure 'ocd_process_reset'
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 251
in procedure 'mmw'
in procedure 'mrw' called at file "/home/amore/zephyr-sdk-0.10.3/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/mem_helper.tcl", line 36
at file "/home/amore/zephyr-sdk-0.10.3/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/mem_helper.tcl", line 6

Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
TARGET: stm32f1x.cpu - Not halted


ERROR: command exited with status 1: /home/amore/zephyr-sdk-0.10.3/sysroots/x86_64-pokysdk-linux/usr/bin/openocd -s /home/amore/zephyr-sdk-0.10.3/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -f /home/amore/zephyrproject/zephyr/boards/arm/stm32_min_dev/support/openocd.cfg -c init -c targets -c 'reset halt' -c 'flash write_image erase /home/amore/zephyrproject/zephyr/samples/basic/blinky/build/zephyr/zephyr.hex' -c 'reset halt' -c 'verify_image /home/amore/zephyrproject/zephyr/samples/basic/blinky/build/zephyr/zephyr.hex' -c 'reset run' -c shutdown
FAILED: zephyr/cmake/flash/CMakeFiles/flash
cd /home/amore/zephyrproject/zephyr/samples/basic/blinky/build && /usr/local/bin/cmake -E env /home/amore/.local/bin/west flash --skip-rebuild
ninja: build stopped: subcommand failed.

Im trying to flash on stm32 min board using ST-Link but it keeps giving me this error.
i have install openocd for the original sites but still keep getting this error.
can someone point me in the right direction.


Re: Adafruit Trinket M0: west flash > How to? #flash #west

William Fish
 

Not completely sure i understand your question but hopefully this will help.

Step 3: west flash
This builds your application then flash your device.

So steps to flash your application are:
Step 1: Identify port

Find port on Linux
  1. Open terminal and type: ls /dev/tty*.

  2. Note the port number listed for /dev/ttyUSB* or /dev/ttyACM*. The port number is represented with * here.

  3. Use the listed port as the serial port. For example: /dev/ttyUSB0.

Step 2: Update the standard config file
This is defined at 'scripts/west_commands/runners/bossac.py' as 
DEFAULT_BOSSAC_PORT = '/dev/ttyACM0'.
Update the port identified in Step 1

Step 3: Build and Flash Board
Run West Flash

If configured correctly West will build and write application to board.

Billy..
 


Re: Adafruit Trinket M0: west flash > How to? #flash #west

Bolivar, Marti
 

Hello,

"yasokada via Lists.Zephyrproject.Org"
<yasokada=gmail.com@...> writes:

Q1. I do not understand why step 3 is necessary.
Q2. If the step 2 is used for flash, how can I change /dev/ttyACM0 to /dev/ttyUSB0 for west flash?
Q3. If step 3 is not relevant to west flash, what is wrong with the above procedure?

I don't have this board, and I can't help you with Q1 or Q3, but for Q2:
you can always run this command to get help on options that are
available to you:

$ west flash --context -d <YOUR_BUILD_DIR>

In this case, you are looking for the --bossac-port option.

Best,
Marti


Adafruit Trinket M0: west flash > How to? #flash #west

@yasokada
 
Edited

My environment:
Ubuntu 18.04 LTS
board: Adafruit Trinket M0
RTOS: Zephyr 2.1.0-rc1

I was trying to use Adafruit Trinket M0.

### connections

https://docs.zephyrproject.org/latest/boards/arm/adafruit_trinket_m0/doc/index.html

> Flash
> ...
> 2. Connect the Trinket M0 to your host computer using USB
> 3. 
Connect a 3.3 V USB to serial adapter to the board and to the host. See the Serial Port section above for the board’s pin connections.

With the above step 2, the device is '/dev/ttyACM0'.
With the above step 3, the device may depends on the used "USB to serial adapter". For example, I use some FTDI adapter, which becomes '/dev/ttyUSB0'.

When I try "west flash", the Zephyr will use "/dev/ttyACM0'. 
This is defined at 'scripts/west_commands/runners/bossac.py' as 
DEFAULT_BOSSAC_PORT = '/dev/ttyACM0'.

So, my understanding is that :

> 2. Connect the Trinket M0 to your host computer using USB
is for west flash.

> 3. Connect a 3.3 V USB to serial adapter to the board and to the host. See the Serial Port section above for the board’s pin connections.
is not clear what to use.

With these information, I thought I can flash by using USB connected at the above step 2.

### west flash

I tried to west flash for Trinket M0.

1. connect USB to Trinket M0
2. sudo chmod +777 /dev/ttyACM0 (to add permission to write flash)
3. west flash

I have following error. What is wrong?

```
$ west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner bossac
bossac: invalid option -- 'o'
Try 'bossac -h' or 'bossac --help' for more information
```

Q1. I do not understand why step 3 is necessary.
Q2. If the step 3 is used for west flash, how can I change /dev/ttyACM0 to /dev/ttyUSB0 for west flash?
Q3. If step 3 is not relevant to west flash, what is wrong with the above procedure?



spi_transceive() does not clock out the SCK for receiving #spi

@yasokada
 

My Environment:
Ubuntu 18.04 LTS
Board: STM32F769 Discovery Kit
RTOS: Zephyr 2.1.0-rc1
Oscilloscope: Analog Discovery 2
SPI device: SRAM memory (23K256)

I am trying to use SPI with my SRAM memory (23K256).
I used spi_transceive() to send and receive with the SRAM memory.
The spi_transceive() can transmit 0x02 0x00 0x10 0xFA with my_spi_tranceive(spi, &spi_cfg, txbufs, 4, NULL, 0);
However, the next spi_transceive() only transmit 0x03 0x00 0x10 with  my_spi_tranceive(spi, &spi_cfg, txbufs, 3, rxbufs, 1);
then, the SCK clock for reading the one byte does not occur.

I also tried by loopbacking the SPI, resulting in same result.

I thought spi_transceive() can send and then receive with SPI device.

What am I missing?

Here is the logic capture when running main.c
(left side is 0x02 0x00 0x10 0xFA, right side is 0x03 0x00 0x10, then without SCK for receiving)




Re: BBC-Microbit PIR sensor #zephyrbluetoothmesh #sensor #ble #bluetoothmesh #gpio

William Fish
 

Hi,
You may want to look at a couple of things to help you answer your own question:

In the zephyr folders;
\boards\arm\bbc_microbit\board.h
It has the list of defines and corresponding pins

The other useful information would be a clear view of the actual physical pins: 
https://tech.microbit.org/hardware/edgeconnector/
I'm sure you will be able to make some progress with this info.

Billy..


Civetweb together with MQTT

Jan Pohanka
 

Hello,
I would like to use web server together with MQTT in same project. 
Unfortunately civetweb sample and MQTT sample have conflicting config requirements with CONFIG_POSIX_API and CONFIG_NET_SOCKETS_POSIX_NAMES.

What would be the right settings here?

best regards
Jan


API meeting: agenda

Carles Cufi
 

Hi all,

This week we will look at:

- PWM, USB and clock_control APIs in the context of stable APIs
- PR: https://github.com/zephyrproject-rtos/zephyr/pull/20657
- PR: https://github.com/zephyrproject-rtos/zephyr/pull/20375
- PR: https://github.com/zephyrproject-rtos/zephyr/issues/20806
- Doc for stable APIs: https://docs.zephyrproject.org/latest/development_process/api_lifecycle.html#stable

- GPIO: Update on progress
- Look at the PRs with driver conversion (https://github.com/zephyrproject-rtos/zephyr/issues/18530)
- Check users of GPIO APIs: https://github.com/zephyrproject-rtos/zephyr/issues/20017
- Tips for converting users can be found here: https://github.com/zephyrproject-rtos/zephyr/issues/20017#issuecomment-549315497 (thanks Peter!)
- Any additional outstanding PRs to topic-gpio

Additional items in the "Triage" column in the GitHub project may be discussed if time permits.
If you want an item included in the meeting, please add it to the GitHub project.

https://github.com/zephyrproject-rtos/zephyr/wiki/Zephyr-Committee-and-Working-Group-Meetings#zephyr-api-discussion
https://github.com/zephyrproject-rtos/zephyr/projects/18
https://docs.google.com/document/d/1lv-8B5QE2m4FjBcvfqAXFIgQfW5oz6306zJ7GIZIWCk/edit

Regards,

Carles


Re: Errors generated when build a sample using clang6.0 #west

Kumar Gala
 

On Nov 25, 2019, at 9:49 PM, istuoli@... wrote:

Hello!
I want to build samples/subsys/power/device_pm using clang6.0 so I do as follows:
1、export ZEPHYR_TOOLCHAIN_VARIANT=llvm
2、mkdir build and cd build
3、cmake -DBOARD=reel_board ..
4、make
Then, I got some errors:

[ 95%] Linking C executable zephyr_prebuilt.elf
clang-6.0: warning: argument unused during compilation: '--specs=nosys.specs' [-Wunused-command-line-argument]
clang-6.0: warning: argument unused during compilation: '-u _OffsetAbsSyms' [-Wunused-command-line-argument]
clang-6.0: warning: argument unused during compilation: '-u _ConfigAbsSyms' [-Wunused-command-line-argument]
clang-6.0: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
/usr/local/bin/ld.lld: error: linker.cmd:189: { expected, but got ALIGN_WITH_INPUT
_bt_channels_area : ALIGN_WITH_INPUT SUBALIGN(4)
^
clang-6.0: error: ld.lld command failed with exit code 1 (use -v to see invocation)
zephyr/CMakeFiles/zephyr_prebuilt.dir/build.make:101: recipe for target 'zephyr/zephyr_prebuilt.elf' failed
make[2]: *** [zephyr/zephyr_prebuilt.elf] Error 1
CMakeFiles/Makefile2:557: recipe for target 'zephyr/CMakeFiles/zephyr_prebuilt.dir/all' failed
make[1]: *** [zephyr/CMakeFiles/zephyr_prebuilt.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Then I turn to west and do:
west build -b reel_board ..
Some similar errors were generated:

[127/132] Linking C executable zephyr/zephyr_prebuilt.elf
FAILED: zephyr/zephyr_prebuilt.elf
: && ccache /usr/local/bin/clang --target=arm-none-eabi --specs=nosys.specs zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr/zephyr_prebuilt.elf -Wl,-T zephyr/linker.cmd -Wl,-Map=/home/lt/zephyrproject/zephyr/samples/subsys/power/device_pm/build/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/libarch__arm__core.a zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/arch/arch/arm/core/cortex_m/mpu/libarch__arm__core__cortex_m__mpu.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/lib/posix/liblib__posix.a zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a zephyr/boards/arm/reel_board/libboards__arm__reel_board.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/i2c/libdrivers__i2c.a zephyr/drivers/serial/libdrivers__serial.a modules/nordic/lib..__modules__hal__nordic.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj -L"/usr/lib/gcc/x86_64-linux-gnu/7.4.0" -L/home/lt/zephyrproject/zephyr/samples/subsys/power/device_pm/build/zephyr -lgcc -fshort-enums -mthumb -mcpu=cortex-m4 -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-section=alignment -u_OffsetAbsSyms -u_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -mabi=aapcs -march=armv7e-m && :
clang-6.0: warning: argument unused during compilation: '--specs=nosys.specs' [-Wunused-command-line-argument]
clang-6.0: warning: argument unused during compilation: '-u _OffsetAbsSyms' [-Wunused-command-line-argument]
clang-6.0: warning: argument unused during compilation: '-u _ConfigAbsSyms' [-Wunused-command-line-argument]
clang-6.0: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
/usr/local/bin/ld.lld: error: zephyr/linker.cmd:189: { expected, but got ALIGN_WITH_INPUT
_bt_channels_area : ALIGN_WITH_INPUT SUBALIGN(4)
^
clang-6.0: error: ld.lld command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
ERROR: command exited with status 1: /usr/local/bin/cmake --build /home/lt/zephyrproject/zephyr/samples/subsys/power/device_pm/build


Is there any suggestion?
Thanks a lot!
_._,_._,_
llvm/clang isn’t supported for ARM SoCs.

- k