Please add support for Keil #877

Open
opened 2022-06-21 06:38:08 -05:00 by myjtag · 63 comments
myjtag commented 2022-06-21 06:38:08 -05:00 (Migrated from github.com)

Hi,
Since we have lots of libraries and code on ARM Keil tools, it would be very helpful if you could add support for it.

Hi, Since we have lots of libraries and code on ARM Keil tools, it would be very helpful if you could add support for it.
GorgonMeducer commented 2022-06-30 18:49:04 -05:00 (Migrated from github.com)

Please let the Pico team concentrate on what they should do. They don't have sufficient resources to add support for MDK.

For MDK support, please try this one:

https://github.com/GorgonMeducer/Pico_Template

Please let the Pico team concentrate on what they should do. They don't have sufficient resources to add support for MDK. For MDK support, please try this one: https://github.com/GorgonMeducer/Pico_Template
myjtag commented 2022-07-03 01:37:48 -05:00 (Migrated from github.com)

Hi
But you are under valuing the Keil tool chain, if you add support for it, I
guarantee your sales would be boosted by 2-3X

Best Regards

On Fri, Jul 1, 2022 at 4:19 AM Gabriel Wang @.***>
wrote:

Please let the Pico team concentrate on what they should do. They don't
have sufficient resources to add support for MDK.

For MDK support, please try this one:

https://github.com/GorgonMeducer/Pico_Template

—
Reply to this email directly, view it on GitHub
https://github.com/raspberrypi/pico-sdk/issues/877#issuecomment-1171777452,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AECNZSP5ZPJJDUVOS7IZAUDVRYW7XANCNFSM5ZMAQAMQ
.
You are receiving this because you authored the thread.Message ID:
@.***>

--
دوست دار شما
علی اسدزاده

Hi But you are under valuing the Keil tool chain, if you add support for it, I guarantee your sales would be boosted by 2-3X Best Regards On Fri, Jul 1, 2022 at 4:19 AM Gabriel Wang ***@***.***> wrote: > Please let the Pico team concentrate on what they should do. They don't > have sufficient resources to add support for MDK. > > For MDK support, please try this one: > > https://github.com/GorgonMeducer/Pico_Template > > — > Reply to this email directly, view it on GitHub > <https://github.com/raspberrypi/pico-sdk/issues/877#issuecomment-1171777452>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AECNZSP5ZPJJDUVOS7IZAUDVRYW7XANCNFSM5ZMAQAMQ> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> > -- دوست دار شما علی اسدزاده
JamesH65 commented 2022-07-03 04:58:33 -05:00 (Migrated from github.com)

That is a very ambitious claim since you don't actually know what our sales actually are...

We are looking in to alternative toolchains.

That is a very ambitious claim since you don't actually know what our sales actually are... We are looking in to alternative toolchains.
myjtag commented 2022-07-04 05:16:13 -05:00 (Migrated from github.com)

I've been using Keil for more than 10 years,and it's the standard tool for
Cortex M development, and I know they have many users, also they have
released the free version a few months ago, before that we had many many
many users with cracks! So I think My guess is not that ambitious.

I hope you would assign some team members to add the official support for
keil too.

Best Regards

On Sun, Jul 3, 2022 at 2:28 PM James Hughes @.***>
wrote:

That is a very ambitious claim since you don't actually know what our
sales actually are...

We are looking in to alternative toolchains.

—
Reply to this email directly, view it on GitHub
https://github.com/raspberrypi/pico-sdk/issues/877#issuecomment-1173050208,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AECNZSK74SEMLZZU5FC67FDVSFP5HANCNFSM5ZMAQAMQ
.
You are receiving this because you authored the thread.Message ID:
@.***>

--
دوست دار شما
علی اسدزاده

I've been using Keil for more than 10 years,and it's the standard tool for Cortex M development, and I know they have many users, also they have released the free version a few months ago, before that we had many many many users with cracks! So I think My guess is not that ambitious. I hope you would assign some team members to add the official support for keil too. Best Regards On Sun, Jul 3, 2022 at 2:28 PM James Hughes ***@***.***> wrote: > That is a very ambitious claim since you don't actually know what our > sales actually are... > > We are looking in to alternative toolchains. > > — > Reply to this email directly, view it on GitHub > <https://github.com/raspberrypi/pico-sdk/issues/877#issuecomment-1173050208>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AECNZSK74SEMLZZU5FC67FDVSFP5HANCNFSM5ZMAQAMQ> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> > -- دوست دار شما علی اسدزاده
bgolab commented 2022-07-14 03:30:17 -05:00 (Migrated from github.com)

I am also interested in Keil support as I am heavy user of Keil for STM32 and so on.

I tried some some you can find here:
https://github.com/GorgonMeducer/Pico_Template

So some ground works is already done...

I am also interested in Keil support as I am heavy user of Keil for STM32 and so on. I tried some some you can find here: https://github.com/GorgonMeducer/Pico_Template So some ground works is already done...
JamesH65 commented 2022-07-14 03:34:55 -05:00 (Migrated from github.com)

This is being looked in to. We do need support from ARM for certain things, which they will not be able to provide until the end of the year, unfortunately. In the meantime, lots of the toolchain already works.

This is being looked in to. We do need support from ARM for certain things, which they will not be able to provide until the end of the year, unfortunately. In the meantime, lots of the toolchain already works.
myjtag commented 2022-07-18 04:08:05 -05:00 (Migrated from github.com)

Thanks, for the update, I hope we will see the official support sooner.
Regards

On Thu, Jul 14, 2022 at 1:05 PM James Hughes @.***>
wrote:

This is being looked in to. We do need support from ARM for certain
things, which they will not be able to provide until the end of the year,
unfortunately. In the meantime, lots of the toolchain already works.

—
Reply to this email directly, view it on GitHub
https://github.com/raspberrypi/pico-sdk/issues/877#issuecomment-1184160320,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AECNZSNBVSYSOWVSGOHGDMDVT7GLVANCNFSM5ZMAQAMQ
.
You are receiving this because you authored the thread.Message ID:
@.***>

--
دوست دار شما
علی اسدزاده

Thanks, for the update, I hope we will see the official support sooner. Regards On Thu, Jul 14, 2022 at 1:05 PM James Hughes ***@***.***> wrote: > This is being looked in to. We do need support from ARM for certain > things, which they will not be able to provide until the end of the year, > unfortunately. In the meantime, lots of the toolchain already works. > > — > Reply to this email directly, view it on GitHub > <https://github.com/raspberrypi/pico-sdk/issues/877#issuecomment-1184160320>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AECNZSNBVSYSOWVSGOHGDMDVT7GLVANCNFSM5ZMAQAMQ> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> > -- دوست دار شما علی اسدزاده
bgolab commented 2023-03-15 13:42:40 -05:00 (Migrated from github.com)

I wonder if there is any update on this issue available.

I wonder if there is any update on this issue available.
GorgonMeducer commented 2023-03-15 14:53:53 -05:00 (Migrated from github.com)

@bgolab, The latest version of Pico-Template now supports flash downloading in MDK.
Please feel free to have a try.

@bgolab, The latest version of Pico-Template now supports flash downloading in MDK. Please feel free to have a try.
myjtag commented 2023-03-16 02:54:13 -05:00 (Migrated from github.com)

Dear Raspberrypi/Pico-Sdk
Hi,
Thanks for the update.

Best regards

On Wed, Mar 15, 2023 at 11:24 PM Gabriel Wang @.***>
wrote:

@bgolab https://github.com/bgolab, The latest version of Pico-Template,
now supports flash downloading in MDK.
Please feel free to have a try.

—
Reply to this email directly, view it on GitHub
https://github.com/raspberrypi/pico-sdk/issues/877#issuecomment-1470749060,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AECNZSPBAIJ4YM4EG272E4TW4IM5XANCNFSM5ZMAQAMQ
.
You are receiving this because you authored the thread.Message ID:
@.***>

--
دوست دار شما
علی اسدزاده

Dear Raspberrypi/Pico-Sdk Hi, Thanks for the update. Best regards On Wed, Mar 15, 2023 at 11:24 PM Gabriel Wang ***@***.***> wrote: > @bgolab <https://github.com/bgolab>, The latest version of Pico-Template, > now supports flash downloading in MDK. > Please feel free to have a try. > > — > Reply to this email directly, view it on GitHub > <https://github.com/raspberrypi/pico-sdk/issues/877#issuecomment-1470749060>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AECNZSPBAIJ4YM4EG272E4TW4IM5XANCNFSM5ZMAQAMQ> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> > -- دوست دار شما علی اسدزاده
will-v-pi commented 2024-05-21 09:31:59 -05:00 (Migrated from github.com)

We have now released an RP2xxx_DFP, which should work as a CMSIS solution for Keil tools. Feel free to give that a go and see if it works for you

We have now released an [RP2xxx_DFP](https://www.keil.arm.com/packs/rp2xxx_dfp-raspberrypi/boards/), which should work as a CMSIS solution for Keil tools. Feel free to give that a go and see if it works for you
bgolab commented 2024-05-21 11:27:57 -05:00 (Migrated from github.com)

Thank you for letting me know.

I wonder if you tested the PICO basic example (the one delivered within DFP) on Keil with Community Licence enabled:
https://www.keil.arm.com/mdk-community/

I use fresh Keil 5.39.0.0 installation with the Community License activated as per the link above.

In my case I got to many compilation errors to proceed.

I wonder If you could share some details how this basic example was tested.

Thank you.

Thank you for letting me know. I wonder if you tested the PICO basic example (the one delivered within DFP) on Keil with Community Licence enabled: https://www.keil.arm.com/mdk-community/ I use fresh Keil 5.39.0.0 installation with the Community License activated as per the link above. In my case I got to many compilation errors to proceed. I wonder If you could share some details how this basic example was tested. Thank you.
will-v-pi commented 2024-05-21 11:35:39 -05:00 (Migrated from github.com)

It has been tested in Keil uVision 5.39.0.0 with the Community License on Windows 11 and works fine, with no compilation errors. Did you install the DFP through the Pack Installer, and then copy the example from that?

The test process was simply to install uVision, use the Pack Installer to install the DFP, and then use the Pack Installer to copy the example and build/run it

It has been tested in Keil uVision 5.39.0.0 with the Community License on Windows 11 and works fine, with no compilation errors. Did you install the DFP through the Pack Installer, and then copy the example from that? The test process was simply to install uVision, use the Pack Installer to install the DFP, and then use the Pack Installer to copy the example and build/run it
bgolab commented 2024-05-21 11:44:25 -05:00 (Migrated from github.com)

Yes, I followed standard approach through the Pack installer then copied the basic example like I do for other MCUs like STM32. Win10.

Did you install all optional components available in the Pack Installer? I mean optional stuff like tensor flow etc?
OR what minimal components are enough apart from DFP and at least CMSIS stuff...

Will try again then.

Thank you.

Yes, I followed standard approach through the Pack installer then copied the basic example like I do for other MCUs like STM32. Win10. Did you install all optional components available in the Pack Installer? I mean optional stuff like tensor flow etc? OR what minimal components are enough apart from DFP and at least CMSIS stuff... Will try again then. Thank you.
will-v-pi commented 2024-05-21 12:03:13 -05:00 (Migrated from github.com)

I didn't install anything other than the RP2xxx_DFP, so no other optional components. The example project has the required components for it selected by default, which are

  • CMSIS
    • Core
  • Compiler
    • Event Recorder (DAP)
    • I/O
      • STDOUT (EVR)
  • Device
    • Startup
    • Pico Board (Pico)
    • Pico SDK

The Event Recorder is just for the retargeted stdout so it can be read over the SWD connection

I didn't install anything other than the RP2xxx_DFP, so no other optional components. The example project has the required components for it selected by default, which are - CMSIS - Core - Compiler - Event Recorder (DAP) - I/O - STDOUT (EVR) - Device - Startup - Pico Board (Pico) - Pico SDK The Event Recorder is just for the retargeted stdout so it can be read over the SWD connection
bgolab commented 2024-05-21 13:00:11 -05:00 (Migrated from github.com)
  1. I reinstalled Keil uVision (previously removed it).
  2. I removed ALL packs located at: C:\users%username%\AppData\Local\Arm\Packs
  3. selected RP2040 and install Rp2040 DFP.
  4. Copied PICO example
  5. added missing components automatically (CMSIS, etc).
    I do not see and Pack dependencies errors anymore.

I tried to compile the PICO example and got 92 errors with repeating sections like this:
Build started: Project: rp2040_example
*** Using Compiler 'V6.21', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Build target 'Pico'
compiling env_wrapper.c...
C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/pico-sdk/src/common/pico_sync/lock_core.c(7): warning: In file included from...
C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/pico-sdk/src/common/pico_sync/include\pico/lock_core.h(12): warning: In file included from...
C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/pico-sdk/src/rp2_common/hardware_sync/include\hardware/sync.h(118): error: static declaration of '__builtin_arm_sev' follows non-static declaration
118 | __force_inline static void __sev(void) {
| ^
././RTE/Device/RP2040_Core0/env_wrapper.h(177): note: expanded from macro '__sev'
177 | #define __sev __builtin_arm_sev
| ^
C:\Keil_v5\ARM\ARMCLANG\Bin..\include\arm_acle.h(52): note: '__builtin_arm_sev' is a builtin with type 'void (void)'
52 | __builtin_arm_sev();


Maybe your setup had some packs already installed - before you started Keil installation - when you remove the Keil uVisions the packs are NOT removed automatically...

1. I reinstalled Keil uVision (previously removed it). 2. I removed ALL packs located at: C:\users\%username%\AppData\Local\Arm\Packs 3. selected RP2040 and install Rp2040 DFP. 4. Copied PICO example 5. added missing components automatically (CMSIS, etc). I do not see and Pack dependencies errors anymore. I tried to compile the PICO example and got 92 errors with repeating sections like this: Build started: Project: rp2040_example *** Using Compiler 'V6.21', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin' Build target 'Pico' compiling env_wrapper.c... C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/pico-sdk/src/common/pico_sync/lock_core.c(7): warning: In file included from... C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/pico-sdk/src/common/pico_sync/include\pico/lock_core.h(12): warning: In file included from... C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/pico-sdk/src/rp2_common/hardware_sync/include\hardware/sync.h(118): error: static declaration of '__builtin_arm_sev' follows non-static declaration 118 | __force_inline static void __sev(void) { | ^ ././RTE/Device/RP2040_Core0/env_wrapper.h(177): note: expanded from macro '__sev' 177 | #define __sev __builtin_arm_sev | ^ C:\Keil_v5\ARM\ARMCLANG\Bin\..\include\arm_acle.h(52): note: '__builtin_arm_sev' is a builtin with type 'void (void)' 52 | __builtin_arm_sev(); ------------ Maybe your setup had some packs already installed - before you started Keil installation - when you remove the Keil uVisions the packs are NOT removed automatically...
will-v-pi commented 2024-05-21 13:25:49 -05:00 (Migrated from github.com)

The test process was simply to install uVision, use the Pack Installer to install the DFP, and then use the Pack Installer to copy the example and build/run it

I have just retried these steps on a clean Windows 11 install, and it worked fine, so I'm not sure what's causing your issues

> The test process was simply to install uVision, use the Pack Installer to install the DFP, and then use the Pack Installer to copy the example and build/run it I have just retried these steps on a clean Windows 11 install, and it worked fine, so I'm not sure what's causing your issues
GorgonMeducer commented 2024-05-21 17:51:09 -05:00 (Migrated from github.com)

@bgolab Which cmsis version do you use?
Can you give us a screenshot about your RTE view.

I can replicate the issue you encountered. Please select cmsis 5.9.0 as a workaround.
The issue you encountered is caused by the latest cmsis 6.0.0 and 6.1.0

image

@bgolab Which cmsis version do you use? Can you give us a screenshot about your RTE view. I can replicate the issue you encountered. Please select cmsis 5.9.0 as a workaround. The issue you encountered is caused by the latest cmsis 6.0.0 and 6.1.0 ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/fca7ba3f-ff3f-43f3-ad0f-ef4b239d7aff)
GorgonMeducer commented 2024-05-21 18:27:31 -05:00 (Migrated from github.com)

I managed to fix the issue with the following changes:

image

image

After adding those changes, it is possible to get along with both cmsis 5.9.0 and cmsis 6.x.0

I managed to fix the issue with the following changes: ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/b37775a5-fd9c-4f23-9215-e566a8e930b1) ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/874786dc-ce57-409d-922a-3326d1609623) After adding those changes, it is possible to get along with both cmsis 5.9.0 and cmsis 6.x.0
lurch commented 2024-05-21 18:32:40 -05:00 (Migrated from github.com)

@GorgonMeducer Related to #1710 , or is that something entirely different?

@GorgonMeducer Related to #1710 , or is that something entirely different?
GorgonMeducer commented 2024-05-21 18:33:17 -05:00 (Migrated from github.com)

@lurch Sorry, after double check, it is the same.

But there are something missing as shown here:

image

@lurch Sorry, after double check, it is the same. But there are something missing as shown here: ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/b37775a5-fd9c-4f23-9215-e566a8e930b1)
GorgonMeducer commented 2024-05-21 18:43:00 -05:00 (Migrated from github.com)

@bgolab @will-v-pi I have created an fixed pack, please have a try.

RaspberryPi.RP2xxx_DFP.0.9.5-dev.pack.zip

NOTE: this isn't an official release.

After install this cmsis-pack, you need to update the env_wrapper.h as shown below:

image

@bgolab @will-v-pi I have created an fixed pack, please have a try. [RaspberryPi.RP2xxx_DFP.0.9.5-dev.pack.zip](https://github.com/raspberrypi/pico-sdk/files/15396704/RaspberryPi.RP2xxx_DFP.0.9.5-dev.pack.zip) NOTE: this isn't an official release. After install this cmsis-pack, you need to update the env_wrapper.h as shown below: ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/194c56c8-bfba-48b3-b59a-20c9e1e8db6b)
bgolab commented 2024-05-22 00:04:38 -05:00 (Migrated from github.com)
  1. I use brand new Keil 5.39.0.0 installation, with CMSIS 6.1.0. The default installation.
    I cannot figure out why in my case I failed but in case of @will-v-pi (if the same CMSIS version was really used) everything is fine? What's the difference?

  2. @GorgonMeducer Yes, selecting CMSIS 5.9.0 fixes the problem. Thank you.

1. I use brand new Keil 5.39.0.0 installation, with CMSIS 6.1.0. The default installation. I cannot figure out why in my case I failed but in case of @will-v-pi (if the same CMSIS version was really used) everything is fine? What's the difference? 2. @GorgonMeducer Yes, selecting CMSIS 5.9.0 fixes the problem. Thank you.
will-v-pi commented 2024-05-22 04:50:08 -05:00 (Migrated from github.com)

I can confirm that I was using a slightly older installer of uVision, which still installed uVision 5.39.0.0, but defaulted to CMSIS version 5.9.0 rather than 6.1.0, which was causing the discrepancy. Will update the pack to work with 6.1.0

Edit: It looks like I was using the current version of the installer, it just installs 5.9.0 by default rather than 6.1.0 on my system, so I'm not sure why @bgolab gets 6.1.0 by default when I get 5.9.0?

I can confirm that I was using a slightly older installer of uVision, which still installed uVision 5.39.0.0, but defaulted to CMSIS version 5.9.0 rather than 6.1.0, which was causing the discrepancy. Will update the pack to work with 6.1.0 Edit: It looks like I was using the current version of the installer, it just installs 5.9.0 by default rather than 6.1.0 on my system, so I'm not sure why @bgolab gets 6.1.0 by default when I get 5.9.0?
bgolab commented 2024-05-22 05:05:25 -05:00 (Migrated from github.com)

Yes, in my case I had to install CMSIS 5.9.0 manually. The 6.1.0 was out of the box.

Yes, in my case I had to install CMSIS 5.9.0 manually. The 6.1.0 was out of the box.
GorgonMeducer commented 2024-05-22 05:27:45 -05:00 (Migrated from github.com)

@bgolab can you check whether the cmsis-pack I attached could solve the problem or not?

@bgolab can you check whether the cmsis-pack I attached could solve the problem or not?
GorgonMeducer commented 2024-05-22 05:34:40 -05:00 (Migrated from github.com)

so I'm not sure why @bgolab gets 6.1.0 by default when I get 5.9.0?

When people run pack-installer and see there is newer version of cmsis-pack, it is normal to click the update button.

And Arm recommends people to use the latest cmsis also.

> so I'm not sure why @bgolab gets 6.1.0 by default when I get 5.9.0? When people run pack-installer and see there is newer version of cmsis-pack, it is normal to click the update button. And Arm recommends people to use the latest cmsis also.
bgolab commented 2024-05-22 05:41:23 -05:00 (Migrated from github.com)

I wrote earlier that CMSIS 5.9.0 fixes the issue.

I wrote earlier that CMSIS 5.9.0 fixes the issue.
bgolab commented 2024-05-22 05:43:55 -05:00 (Migrated from github.com)

More interesting problem - if you change the linker setting and try to link the code to SRAM area you will get some errors:
_Build started: Project: test1
*** Using Compiler 'V6.21', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Build target 'Pico'
linking...
.\Objects\rp2040_example.axf: Error: L6915E: Library reports error: __use_no_semihosting was requested, but __user_initial_stackheap was referenced
.\Objects\rp2040_example.axf: Error: L6915E: Library reports error: The semihosting _user_initial_stackheap cannot reliably set up a usable heap region if scatter loading is in use
Not enough information to list load addresses in the image map.
Finished: 1 information, 0 warning and 2 error messages.
".\Objects\rp2040_example.axf" - 2 Error(s), 0 Warning(s).
Target not created.

image

More interesting problem - if you change the linker setting and try to link the code to SRAM area you will get some errors: _Build started: Project: test1 *** Using Compiler 'V6.21', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin' Build target 'Pico' linking... .\Objects\rp2040_example.axf: Error: L6915E: Library reports error: __use_no_semihosting was requested, but __user_initial_stackheap was referenced .\Objects\rp2040_example.axf: Error: L6915E: Library reports error: The semihosting __user_initial_stackheap cannot reliably set up a usable heap region if scatter loading is in use Not enough information to list load addresses in the image map. Finished: 1 information, 0 warning and 2 error messages. ".\Objects\rp2040_example.axf" - 2 Error(s), 0 Warning(s). Target not created._ ![image](https://github.com/raspberrypi/pico-sdk/assets/2932521/f47ec4b9-e7d2-4d5f-bc25-a7c2a3368bfa)
GorgonMeducer commented 2024-05-22 07:29:28 -05:00 (Migrated from github.com)

@bgolab

I wrote earlier that CMSIS 5.9.0 fixes the issue.

I mean using the latest cmsis-pack (i.e. 0.9.5-dev) and work with cmsis 6.1.0

For the issue you encountered, please send the linker script you modified. Based on the error info from compiler, you might have removed the ARM_LIB_STACK and ARM_LIB_HEAP region in the linker script.

You can try this one:

https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_run_in_sram.sct

@bgolab > I wrote earlier that CMSIS 5.9.0 fixes the issue. I mean using the latest cmsis-pack (i.e. 0.9.5-dev) and work with cmsis 6.1.0 For the issue you encountered, please send the linker script you modified. Based on the error info from compiler, you might have removed the `ARM_LIB_STACK` and `ARM_LIB_HEAP` region in the linker script. You can try this one: https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_run_in_sram.sct
bgolab commented 2024-05-22 07:36:22 -05:00 (Migrated from github.com)

I simply used the Target tab setting as shown earlier:
-the SRAM was shared between the code and data - please see the picture above.

Nothing special - just simulated no_flash option from the original RPI SDK.

I simply used the Target tab setting as shown earlier: -the SRAM was shared between the code and data - please see the picture above. Nothing special - just simulated no_flash option from the original RPI SDK.
bgolab commented 2024-05-22 07:38:42 -05:00 (Migrated from github.com)

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x20000000 0x00020000 { ; load region size_region
ER_IROM1 0x20000000 0x00020000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_IRAM1 0x20020000 0x00022000 { ; RW data
.ANY (+RW +ZI)
}
}

; ************************************************************* ; *** Scatter-Loading Description File generated by uVision *** ; ************************************************************* LR_IROM1 0x20000000 0x00020000 { ; load region size_region ER_IROM1 0x20000000 0x00020000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) .ANY (+XO) } RW_IRAM1 0x20020000 0x00022000 { ; RW data .ANY (+RW +ZI) } }
GorgonMeducer commented 2024-05-22 08:12:48 -05:00 (Migrated from github.com)

I simply used the Target tab setting as shown earlier:
-the SRAM was shared between the code and data - please see the picture above.

Nothing special - just simulated no_flash option from the original RPI SDK.

@bgolab This won't work.

You have to make sure the linker script contains ARM_LIB_STACK and ARM_LIB_HEAP

If you want to place code in SRAM, please use the linker script I have shared:

https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_run_in_sram.sct

>I simply used the Target tab setting as shown earlier: >-the SRAM was shared between the code and data - please see the picture above. > >Nothing special - just simulated no_flash option from the original RPI SDK. @bgolab This won't work. You have to make sure the linker script contains `ARM_LIB_STACK` and `ARM_LIB_HEAP` If you want to place code in SRAM, please use the linker script I have shared: https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_run_in_sram.sct
bgolab commented 2024-05-22 08:16:40 -05:00 (Migrated from github.com)

I simply followed the STM32 way of setting the Target tab (and enabling this memory map on the linker tab) when you want to use the SRAM for keeping the code.

Ok. Will follow your advise in case of using it.

I simply followed the STM32 way of setting the Target tab (and enabling this memory map on the linker tab) when you want to use the SRAM for keeping the code. Ok. Will follow your advise in case of using it.
GorgonMeducer commented 2024-05-22 08:31:09 -05:00 (Migrated from github.com)

I simply followed the STM32 way of setting the Target tab

STM32 still follows the old way, i.e. using assembly startup code. In the so-called latest (and recommended way) in cmsis standard, silicon vendors should use C startup code.

The so-called "latest" way, actually can be dated back to 2016.
When using C startup code, you have to add ARM_LIB_STACK and ARM_LIB_HEAP in scatter script to describe STACK and HEAP.

This is the reason and background.

> I simply followed the STM32 way of setting the Target tab STM32 still follows the old way, i.e. using assembly startup code. In the so-called latest (and recommended way) in cmsis standard, silicon vendors should use C startup code. The so-called "latest" way, actually can be dated back to 2016. When using C startup code, you have to add `ARM_LIB_STACK` and `ARM_LIB_HEAP` in scatter script to describe STACK and HEAP. This is the reason and background.
bgolab commented 2024-05-22 08:34:20 -05:00 (Migrated from github.com)

I don't have any problem with following the "new" way. Just got used to the really old way.
Thank you for explanation.

I don't have any problem with following the "new" way. Just got used to the really old way. Thank you for explanation.
GorgonMeducer commented 2024-05-22 08:40:45 -05:00 (Migrated from github.com)

I don't have any problem with following the "new" way. Just got used to the really old way.

For many people, knowing the reason and background helps with inner peace. : p

> I don't have any problem with following the "new" way. Just got used to the really old way. For many people, knowing the reason and background helps with inner peace. : p
bgolab commented 2024-05-22 08:48:00 -05:00 (Migrated from github.com)

Yes, sure. I really appreciate your help.

I wonder what other non-old way approaches I will come across when trying the RP2040 with the Keil uVision (my favorite tool).

Yes, sure. I really appreciate your help. I wonder what other non-old way approaches I will come across when trying the RP2040 with the Keil uVision (my favorite tool).
bgolab commented 2024-05-22 11:24:59 -05:00 (Migrated from github.com)

I tried to use the scatter file you shared with the basic PICO example and selected the sct file in Linker tab.
image

It looks like I need to do something else because the generated code is still linked in the flash area.
Am I missing something?

I tried to use the scatter file you shared with the basic PICO example and selected the sct file in Linker tab. ![image](https://github.com/raspberrypi/pico-sdk/assets/2932521/7b853c29-d87d-4f86-8055-4513793ce8bb) It looks like I need to do something else because the generated code is still linked in the flash area. Am I missing something?
GorgonMeducer commented 2024-05-22 11:39:00 -05:00 (Migrated from github.com)

It looks like I need to do something else because the generated code is still linked in the flash area.

How do you know? Did you check the map file?

There are always some code in the flash (the load region) but the code is actually running in SRAM (execution region).

During the startup, the code in the load region will be copied to the execution region (in SRAM).

image

So except the startup_RP2040.o and Stage2 BOOT, all your code is running in SRAM (although there are stored in Flash).

With this configuration, the application can survive to the next power-up.

I hope this helps.

If you truly want everything in SRAM and don't want the application survive to the next power-up, you can try this:

https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_debug_in_sram.sct

> It looks like I need to do something else because the generated code is still linked in the flash area. How do you know? Did you check the map file? There are always some code in the flash (the load region) but the code is actually running in SRAM (execution region). During the startup, the code in the load region will be copied to the execution region (in SRAM). ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/981e8ac6-07c5-4106-9bd4-e029206b4be2) So except the startup_RP2040.o and Stage2 BOOT, all your code is running in SRAM (although there are stored in Flash). With this configuration, the application can survive to the next power-up. I hope this helps. If you truly want everything in SRAM and don't want the application survive to the next power-up, you can try this: https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_debug_in_sram.sct
bgolab commented 2024-05-22 12:04:30 -05:00 (Migrated from github.com)

I have a script which checks the uf2 file to retrieve code memory locations. Also it looks like that the map file confirms it.

If it comes to the RPI SDK the "no_flash" set in the CMAKE config means that no flash is involved when loading the code to the execution area (the code is loaded directly to the SRAM area without any debugger help like we do in the case of STM32).
Simple drag&drop into emulated disk does the job. And the flash is not written at all.

Yes, I see the difference between flash loaded code from code directly loaded to the SRAM case.
Thank you.

I have a script which checks the uf2 file to retrieve code memory locations. Also it looks like that the map file confirms it. --- If it comes to the RPI SDK the "no_flash" set in the CMAKE config means that no flash is involved when loading the code to the execution area (the code is loaded directly to the SRAM area without any debugger help like we do in the case of STM32). Simple drag&drop into emulated disk does the job. And the flash is not written at all. Yes, I see the difference between flash loaded code from code directly loaded to the SRAM case. Thank you.
bgolab commented 2024-05-22 12:12:15 -05:00 (Migrated from github.com)

When selected the RP2040_debug_in_sram.sct scatter file I got the following errors.
We can stop the investigation here not to waste more time - probably nobody cares for SRAM use case.

After Build - User command #2: C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/tools\elf2uf2.exe "C:\Users\abg015\Documents\Keil\test1-sram\Objects\rp2040_example.axf" ".\rp2040_example.uf2"
ERROR: A RAM binary should have an entry point at the beginning: 20000001 (not 200000c1)

When selected the RP2040_debug_in_sram.sct scatter file I got the following errors. We can stop the investigation here not to waste more time - probably nobody cares for SRAM use case. After Build - User command #2: C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/tools\elf2uf2.exe "C:\Users\abg015\Documents\Keil\test1-sram\Objects\rp2040_example.axf" ".\rp2040_example.uf2" ERROR: A RAM binary should have an entry point at the beginning: 20000001 (not 200000c1)
GorgonMeducer commented 2024-05-22 14:25:20 -05:00 (Migrated from github.com)

@bgolab this RP2040_debug_in_sram.sct is used for debug, that means we don't care about the elf2uf2.exe report, i.e. we don't need uf2. The MDK will load the image (*.axf) to the RP2040 directly

@bgolab this RP2040_debug_in_sram.sct is used for debug, that means we don't care about the elf2uf2.exe report, i.e. we don't need uf2. The MDK will load the image (*.axf) to the RP2040 directly
GorgonMeducer commented 2024-05-22 14:29:51 -05:00 (Migrated from github.com)

If it comes to the RPI SDK the "no_flash" set in the CMAKE config means that no flash is involved when loading the code to the execution area (the code is loaded directly to the SRAM area without any debugger help like we do in the case of STM32).

The key is, what is the ultimate goal? running code in SRAM or load code to sram without involving flash.
Usually, people want to run code in sram for the best performance. What's the actual use case that you want to load code to sram without involving flash? or why running code in sram (load at startup-time) is an unaccepted solution for you?

  • probably nobody cares for SRAM use case.

As you can see, I really care, so that's why I am trying my best to understand the reason behind a request.

> If it comes to the RPI SDK the "no_flash" set in the CMAKE config means that no flash is involved when loading the code to the execution area (the code is loaded directly to the SRAM area without any debugger help like we do in the case of STM32). The key is, what is the ultimate goal? running code in SRAM or load code to sram without involving flash. Usually, people want to run code in sram for the best performance. What's the actual use case that you want to load code to sram without involving flash? or why running code in sram (load at startup-time) is an unaccepted solution for you? > - probably nobody cares for SRAM use case. As you can see, I really care, so that's why I am trying my best to understand the reason behind a request.
bgolab commented 2024-05-22 14:43:38 -05:00 (Migrated from github.com)

One may ask why the RPI built-in this option to the bootloader - I mean ability to load & execute the code in to the SRAM area.
Every Arm Cortex is able to do this - in the case of other non-RP2040 case we have to use external SWD or JTAG debugger. Some Cortex MCUs like STM32 can do this through the serial/I2C interface built-in into the bootloader.
So the RP2040 simply continues to support Cortex well-known feature.

I like using this option personally during the development phase, for small programs since I ran into some flash issues years ago (this was TI MCU with pretty limited number of writes).

I do not want to start the discussion about flash longevity nowdays, etc.

It was not a request - I asked about this out of curiosity to see if there is basic feature pairing between the RPI SDK and Keil uVision.

Again, please do not waste your time on this niche feature.
Thank you.

One may ask why the RPI built-in this option to the bootloader - I mean ability to load & execute the code in to the SRAM area. Every Arm Cortex is able to do this - in the case of other non-RP2040 case we have to use external SWD or JTAG debugger. Some Cortex MCUs like STM32 can do this through the serial/I2C interface built-in into the bootloader. So the RP2040 simply continues to support Cortex well-known feature. I like using this option personally during the development phase, for small programs since I ran into some flash issues years ago (this was TI MCU with pretty limited number of writes). I do not want to start the discussion about flash longevity nowdays, etc. It was not a request - I asked about this out of curiosity to see if there is basic feature pairing between the RPI SDK and Keil uVision. Again, please do not waste your time on this niche feature. Thank you.
lurch commented 2024-05-22 15:11:57 -05:00 (Migrated from github.com)

As you can see, I really care, so that's why I am trying my best to understand the reason behind a request.

If you're looking for a simple example, see https://github.com/raspberrypi/pico-examples/tree/master/flash/nuke
It builds a UF2 file which you can drag'n'drop onto a Pico (i.e. no need for SWD or a debugger) in BOOTSEL mode. It runs entirely from SRAM and simply erases the content of Flash.

> As you can see, I really care, so that's why I am trying my best to understand the reason behind a request. If you're looking for a simple example, see https://github.com/raspberrypi/pico-examples/tree/master/flash/nuke It builds a [UF2 file](https://datasheets.raspberrypi.com/soft/flash_nuke.uf2) which you can drag'n'drop onto a Pico (i.e. no need for SWD or a debugger) in [BOOTSEL mode](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#resetting-flash-memory). It runs entirely from SRAM and simply erases the content of Flash.
GorgonMeducer commented 2024-05-22 17:43:53 -05:00 (Migrated from github.com)

@bgolab @lurch I understand now.

I have applied a fix to the scatter script
https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_debug_in_sram.sct
and now it works perfectly on my side:

image

image

Would you mind trying the Pico-Template?

I have updated it to use RP2xxx_DFP.

Please switch to the AC6-DebugInSRAM

image

@bgolab @lurch I understand now. I have applied a fix to the scatter script https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_debug_in_sram.sct and now it works perfectly on my side: ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/d48ef600-eaad-4adf-bc8c-4cb62166dfae) ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/fdf5938b-8d8e-4a8c-9a50-9deee5e49e63) Would you mind trying the [Pico-Template](https://github.com/GorgonMeducer/Pico_Template)? I have updated it to use RP2xxx_DFP. Please switch to the AC6-DebugInSRAM ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/27ff1c29-448a-4c87-9d5e-9400d91faa1a)
bgolab commented 2024-05-23 00:00:34 -05:00 (Migrated from github.com)

Linker tab: I see that you set R/O base to 0x0000000 whereas I had 0x10000000 when failed.
But changing this did not help. Got the same errors.

PS. I believe I tested your templates in the past. This time I would like to use the official release to compare.

Linker tab: I see that you set R/O base to 0x0000000 whereas I had 0x10000000 when failed. But changing this did not help. Got the same errors. PS. I believe I tested your templates in the past. This time I would like to use the official release to compare.
GorgonMeducer commented 2024-05-23 06:51:29 -05:00 (Migrated from github.com)

Linker tab: I see that you set R/O base to 0x0000000 whereas I had 0x10000000 when failed.

Once we use linker script, this kind of option won't affect the final result.

Got the same errors.

Can you pass me the map file?

This time I would like to use the official release to compare.

As I mentioned above, I have updated the Pico-Template to use official RP2xxx_DFP. The reason I asked you to try it is because this could become the common example project for us to understand the reason behind the issue you encountered.

> Linker tab: I see that you set R/O base to 0x0000000 whereas I had 0x10000000 when failed. Once we use linker script, this kind of option won't affect the final result. > Got the same errors. Can you pass me the map file? > This time I would like to use the official release to compare. As I mentioned above, I have updated the Pico-Template to use official RP2xxx_DFP. The reason I asked you to try it is because this could become the common example project for us to understand the reason behind the issue you encountered.
bgolab commented 2024-05-23 07:01:58 -05:00 (Migrated from github.com)

rp2040_example.map.txt
renamed to txt to upload...

[rp2040_example.map.txt](https://github.com/raspberrypi/pico-sdk/files/15416468/rp2040_example.map.txt) renamed to txt to upload...
GorgonMeducer commented 2024-05-23 08:34:01 -05:00 (Migrated from github.com)

@bgolab Can you attach the linker script also? The reason I ask this is because, the map file looks strange.
I know you suppose to use the linker script I provided, but just in case, please send me the one you actually uses

Memory Map of the image

  Image Entry point : 0x200000c1

  Load Region LR_IROM1 (Base: 0x20000000, Size: 0x000052e0, Max: 0x0003e000, ABSOLUTE)

    Execution Region ER_BINRAY_INFO (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE)

    **** No section assigned to this execution region ****


    Execution Region ER_FLASH (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000900, Max: 0xffffffff, ABSOLUTE)

    Exec Addr    Load Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x20000000   0x20000000   0x000000c0   Data   RO          709    RESET               lto-llvm-5f2a3e.o
    0x200000c0   0x200000c0   0x00000008   Code   RO          220  * !!!main             c_p.l(__main.o)
    0x200000c8   0x200000c8   0x00000054   Code   RO          729    !!!scatter          c_p.l(__scatter.o)
    0x2000011c   0x2000011c   0x0000001a   Code   RO          733    !!handler_copy      c_p.l(__scatter_copy.o)

This is the one on myside:

Memory Map of the image

  Image Entry point : 0x20000001

  Load Region LR_IROM1 (Base: 0x20000000, Size: 0x00005430, Max: 0x0003e000, ABSOLUTE)

    Execution Region ER_BINRAY_INFO (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x0000002c, Max: 0xffffffff, ABSOLUTE)

    Exec Addr    Load Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x20000000   0x20000000   0x0000002c   Code   RO          751  * .text.Reset_Handler  lto-llvm-483d6d.o


    Execution Region ER_RAM_VECTOR_TABLE (Exec base: 0x20000100, Load base: 0x20000100, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE)

    **** No section assigned to this execution region ****


    Execution Region ER_FLASH (Exec base: 0x20000100, Load base: 0x20000100, Size: 0x00000858, Max: 0xffffffff, ABSOLUTE)

    Exec Addr    Load Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x20000100   0x20000100   0x000000c0   Data   RO          795    RESET               lto-llvm-483d6d.o
    0x200001c0   0x200001c0   0x00000008   Code   RO          268  * !!!main             c_p.l(__main.o)
    0x200001c8   0x200001c8   0x00000054   Code   RO          834    !!!scatter          c_p.l(__scatter.o)
    0x2000021c   0x2000021c   0x0000001a   Code   RO          838    !!handler_copy      c_p.l(__scatter_copy.o)

You might notice that the key difference is the Reset_Handler is placed at the start of the 0x20000000

    Exec Addr    Load Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x20000000   0x20000000   0x0000002c   Code   RO          751  * .text.Reset_Handler  lto-llvm-483d6d.o

This is the key difference.

image

In your map file, I found this:

Reset_Handler                            0x200031e9   Thumb Code    24  lto-llvm-5f2a3e.o(.text.Reset_Handler)

This is the location of Reset_Handler in my map file:

Reset_Handler                            0x20000001   Thumb Code    24  lto-llvm-483d6d.o(.text.Reset_Handler)

Based on this, I really want to check the linker script you actually use.

@bgolab Can you attach the linker script also? The reason I ask this is because, the map file looks strange. I know you suppose to use the linker script I provided, but just in case, please send me the one you actually uses ``` Memory Map of the image Image Entry point : 0x200000c1 Load Region LR_IROM1 (Base: 0x20000000, Size: 0x000052e0, Max: 0x0003e000, ABSOLUTE) Execution Region ER_BINRAY_INFO (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE) **** No section assigned to this execution region **** Execution Region ER_FLASH (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000900, Max: 0xffffffff, ABSOLUTE) Exec Addr Load Addr Size Type Attr Idx E Section Name Object 0x20000000 0x20000000 0x000000c0 Data RO 709 RESET lto-llvm-5f2a3e.o 0x200000c0 0x200000c0 0x00000008 Code RO 220 * !!!main c_p.l(__main.o) 0x200000c8 0x200000c8 0x00000054 Code RO 729 !!!scatter c_p.l(__scatter.o) 0x2000011c 0x2000011c 0x0000001a Code RO 733 !!handler_copy c_p.l(__scatter_copy.o) ``` This is the one on myside: ``` Memory Map of the image Image Entry point : 0x20000001 Load Region LR_IROM1 (Base: 0x20000000, Size: 0x00005430, Max: 0x0003e000, ABSOLUTE) Execution Region ER_BINRAY_INFO (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x0000002c, Max: 0xffffffff, ABSOLUTE) Exec Addr Load Addr Size Type Attr Idx E Section Name Object 0x20000000 0x20000000 0x0000002c Code RO 751 * .text.Reset_Handler lto-llvm-483d6d.o Execution Region ER_RAM_VECTOR_TABLE (Exec base: 0x20000100, Load base: 0x20000100, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE) **** No section assigned to this execution region **** Execution Region ER_FLASH (Exec base: 0x20000100, Load base: 0x20000100, Size: 0x00000858, Max: 0xffffffff, ABSOLUTE) Exec Addr Load Addr Size Type Attr Idx E Section Name Object 0x20000100 0x20000100 0x000000c0 Data RO 795 RESET lto-llvm-483d6d.o 0x200001c0 0x200001c0 0x00000008 Code RO 268 * !!!main c_p.l(__main.o) 0x200001c8 0x200001c8 0x00000054 Code RO 834 !!!scatter c_p.l(__scatter.o) 0x2000021c 0x2000021c 0x0000001a Code RO 838 !!handler_copy c_p.l(__scatter_copy.o) ``` You might notice that the key difference is the Reset_Handler is placed at the start of the 0x20000000 ``` Exec Addr Load Addr Size Type Attr Idx E Section Name Object 0x20000000 0x20000000 0x0000002c Code RO 751 * .text.Reset_Handler lto-llvm-483d6d.o ``` This is the key difference. ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/027e00b3-e440-45e0-b44c-e1a0bb3f58b3) In your map file, I found this: ``` Reset_Handler 0x200031e9 Thumb Code 24 lto-llvm-5f2a3e.o(.text.Reset_Handler) ``` This is the location of Reset_Handler in my map file: ``` Reset_Handler 0x20000001 Thumb Code 24 lto-llvm-483d6d.o(.text.Reset_Handler) ``` Based on this, I really want to check the linker script you actually use.
bgolab commented 2024-05-23 08:45:30 -05:00 (Migrated from github.com)

Current settings of the Linker tab and latest / freshest file (BTW. I have not touched the content of the linker file):
image

[RP2040_debug_in_sra
rp2040_example.map.txt
m.sct.txt](https://github.com/raspberrypi/pico-sdk/files/15417662/RP2040_debug_in_sram.sct.txt)

Current settings of the Linker tab and latest / freshest file (BTW. I have not touched the content of the linker file): ![image](https://github.com/raspberrypi/pico-sdk/assets/2932521/6fdf81c8-325c-4cd7-a384-45c03445c6f1) [RP2040_debug_in_sra [rp2040_example.map.txt](https://github.com/raspberrypi/pico-sdk/files/15417666/rp2040_example.map.txt) m.sct.txt](https://github.com/raspberrypi/pico-sdk/files/15417662/RP2040_debug_in_sram.sct.txt)
GorgonMeducer commented 2024-05-23 08:46:40 -05:00 (Migrated from github.com)

@bgolab You are not using the latest RP2040_debug_in_sram.sct

Please use the latest one.

https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_debug_in_sram.sct

It is different from the one you currently using.

Thank you.

This is the one you using:

image

This is the latest one:

image

@bgolab You are not using the latest RP2040_debug_in_sram.sct Please use the latest one. https://github.com/GorgonMeducer/Pico_Template/blob/main/project/mdk/RP2040_debug_in_sram.sct It is different from the one you currently using. Thank you. This is the one you using: <img width="693" alt="image" src="https://github.com/raspberrypi/pico-sdk/assets/13148491/cf4a64bb-5a4e-4d11-bd32-0a83a3edba08"> This is the latest one: ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/d6045574-0b70-45e3-9c6b-a90bb9e96dff)
bgolab commented 2024-05-23 08:51:25 -05:00 (Migrated from github.com)

I lost control of this. This time should be ok:

Program Size: Code=18804 RO-data=2152 RW-data=260 ZI-data=41148
After Build - User command #2: C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/tools\elf2uf2.exe "C:\Users\abg015\Documents\Keil\test1-sram\Objects\rp2040_example.axf" ".\rp2040_example.uf2"
ERROR: A RAM binary should have an entry point at the beginning: 20000001 (not 20000181)
".\Objects\rp2040_example.axf" - 0 Error(s), 0 Warning(s).

RP2040_debug_in_sram.sct.txt

I lost control of this. This time should be ok: Program Size: Code=18804 RO-data=2152 RW-data=260 ZI-data=41148 After Build - User command #2: C:/Users/abg015/AppData/Local/Arm/Packs/RaspberryPi/RP2xxx_DFP/0.9.4/tools\elf2uf2.exe "C:\Users\abg015\Documents\Keil\test1-sram\Objects\rp2040_example.axf" ".\rp2040_example.uf2" ERROR: A RAM binary should have an entry point at the beginning: 20000001 (not 20000181) ".\Objects\rp2040_example.axf" - 0 Error(s), 0 Warning(s). [RP2040_debug_in_sram.sct.txt](https://github.com/raspberrypi/pico-sdk/files/15417756/RP2040_debug_in_sram.sct.txt)
bgolab commented 2024-05-23 08:51:50 -05:00 (Migrated from github.com)
[rp2040_example.map (2).txt](https://github.com/raspberrypi/pico-sdk/files/15417778/rp2040_example.map.2.txt)
GorgonMeducer commented 2024-05-23 12:12:15 -05:00 (Migrated from github.com)

@bgolab I managed to replicate the same issue on myside, please add --entry=Reset_Handler to the Misc Controls in the linker tab as shown below:

image

Without this option:

Memory Map of the image

  Image Entry point : 0x200000c1

  Load Region LR_IROM1 (Base: 0x20000000, Size: 0x00005358, Max: 0x0003e000, ABSOLUTE)

    Execution Region ER_BINRAY_INFO (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE)

    **** No section assigned to this execution region ****


    Execution Region ER_RAM_VECTOR_TABLE (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE)

    **** No section assigned to this execution region ****


    Execution Region ER_FLASH (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000858, Max: 0xffffffff, ABSOLUTE)

    Exec Addr    Load Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x20000000   0x20000000   0x000000c0   Data   RO          795    RESET               lto-llvm-f71e40.o
    0x200000c0   0x200000c0   0x00000008   Code   RO          268  * !!!main             c_p.l(__main.o)
    0x200000c8   0x200000c8   0x00000054   Code   RO          834    !!!scatter          c_p.l(__scatter.o)
    0x2000011c   0x2000011c   0x0000001a   Code   RO          838    !!handler_copy      c_p.l(__scatter_copy.o)
    0x20000136   0x20000136   0x00000002   PAD
    0x20000138   0x20000138   0x00000002   Code   RO          835    !!handler_null      c_p.l(__scatter.o)
    0x2000013a   0x2000013a   0x00000002   PAD
    0x2000013c   0x2000013c   0x0000001c   Code   RO          840    !!handler_zi        c_p.l(__scatter_zi.o)

With this option:

Memory Map of the image

  Image Entry point : 0x20000001

  Load Region LR_IROM1 (Base: 0x20000000, Size: 0x00005430, Max: 0x0003e000, ABSOLUTE)

    Execution Region ER_BINRAY_INFO (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x0000002c, Max: 0xffffffff, ABSOLUTE)

    Exec Addr    Load Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x20000000   0x20000000   0x0000002c   Code   RO          751  * .text.Reset_Handler  lto-llvm-ed53d8.o


    Execution Region ER_RAM_VECTOR_TABLE (Exec base: 0x20000100, Load base: 0x20000100, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE)

    **** No section assigned to this execution region ****


    Execution Region ER_FLASH (Exec base: 0x20000100, Load base: 0x20000100, Size: 0x00000858, Max: 0xffffffff, ABSOLUTE)

    Exec Addr    Load Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x20000100   0x20000100   0x000000c0   Data   RO          795    RESET               lto-llvm-ed53d8.o
    0x200001c0   0x200001c0   0x00000008   Code   RO          268  * !!!main             c_p.l(__main.o)
    0x200001c8   0x200001c8   0x00000054   Code   RO          834    !!!scatter          c_p.l(__scatter.o)
    0x2000021c   0x2000021c   0x0000001a   Code   RO          838    !!handler_copy      c_p.l(__scatter_copy.o)
    0x20000236   0x20000236   0x00000002   PAD
    0x20000238   0x20000238   0x00000002   Code   RO          835    !!handler_null      c_p.l(__scatter.o)
    0x2000023a   0x2000023a   0x00000002   PAD
@bgolab I managed to replicate the same issue on myside, please add `--entry=Reset_Handler` to the Misc Controls in the linker tab as shown below: ![image](https://github.com/raspberrypi/pico-sdk/assets/13148491/dbaa13a2-8e17-4d8e-b6af-06088d9865dd) Without this option: ``` Memory Map of the image Image Entry point : 0x200000c1 Load Region LR_IROM1 (Base: 0x20000000, Size: 0x00005358, Max: 0x0003e000, ABSOLUTE) Execution Region ER_BINRAY_INFO (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE) **** No section assigned to this execution region **** Execution Region ER_RAM_VECTOR_TABLE (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE) **** No section assigned to this execution region **** Execution Region ER_FLASH (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x00000858, Max: 0xffffffff, ABSOLUTE) Exec Addr Load Addr Size Type Attr Idx E Section Name Object 0x20000000 0x20000000 0x000000c0 Data RO 795 RESET lto-llvm-f71e40.o 0x200000c0 0x200000c0 0x00000008 Code RO 268 * !!!main c_p.l(__main.o) 0x200000c8 0x200000c8 0x00000054 Code RO 834 !!!scatter c_p.l(__scatter.o) 0x2000011c 0x2000011c 0x0000001a Code RO 838 !!handler_copy c_p.l(__scatter_copy.o) 0x20000136 0x20000136 0x00000002 PAD 0x20000138 0x20000138 0x00000002 Code RO 835 !!handler_null c_p.l(__scatter.o) 0x2000013a 0x2000013a 0x00000002 PAD 0x2000013c 0x2000013c 0x0000001c Code RO 840 !!handler_zi c_p.l(__scatter_zi.o) ``` With this option: ``` Memory Map of the image Image Entry point : 0x20000001 Load Region LR_IROM1 (Base: 0x20000000, Size: 0x00005430, Max: 0x0003e000, ABSOLUTE) Execution Region ER_BINRAY_INFO (Exec base: 0x20000000, Load base: 0x20000000, Size: 0x0000002c, Max: 0xffffffff, ABSOLUTE) Exec Addr Load Addr Size Type Attr Idx E Section Name Object 0x20000000 0x20000000 0x0000002c Code RO 751 * .text.Reset_Handler lto-llvm-ed53d8.o Execution Region ER_RAM_VECTOR_TABLE (Exec base: 0x20000100, Load base: 0x20000100, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE) **** No section assigned to this execution region **** Execution Region ER_FLASH (Exec base: 0x20000100, Load base: 0x20000100, Size: 0x00000858, Max: 0xffffffff, ABSOLUTE) Exec Addr Load Addr Size Type Attr Idx E Section Name Object 0x20000100 0x20000100 0x000000c0 Data RO 795 RESET lto-llvm-ed53d8.o 0x200001c0 0x200001c0 0x00000008 Code RO 268 * !!!main c_p.l(__main.o) 0x200001c8 0x200001c8 0x00000054 Code RO 834 !!!scatter c_p.l(__scatter.o) 0x2000021c 0x2000021c 0x0000001a Code RO 838 !!handler_copy c_p.l(__scatter_copy.o) 0x20000236 0x20000236 0x00000002 PAD 0x20000238 0x20000238 0x00000002 Code RO 835 !!handler_null c_p.l(__scatter.o) 0x2000023a 0x2000023a 0x00000002 PAD ```
bgolab commented 2024-05-23 12:22:51 -05:00 (Migrated from github.com)

Yes, the '--entry=Reset_Handler' magic setting helped. It looks like not everything is controlled by the sct.

The old-way of controlling linker settings in such simple scenario like this (just moving the code region to SRAM area) wasn't so bad;)

Thank you.

Yes, the '--entry=Reset_Handler' magic setting helped. It looks like not everything is controlled by the sct. The old-way of controlling linker settings in such simple scenario like this (just moving the code region to SRAM area) wasn't so bad;) Thank you.
bgolab commented 2024-05-23 12:25:42 -05:00 (Migrated from github.com)

UF2 verified by my script that the code is located in SRAM:
rp2040_example.uf2.log

UF2 verified by my script that the code is located in SRAM: [rp2040_example.uf2.log](https://github.com/raspberrypi/pico-sdk/files/15420409/rp2040_example.uf2.log)
GorgonMeducer commented 2024-05-23 12:35:52 -05:00 (Migrated from github.com)

@bgolab You mixed different things up.

The old-way of controlling linker settings in such simple scenario like this (just moving the code region to SRAM area) wasn't so bad;)

The Old way won't help.

This is because RP2040 BOOTROM only wants the Reset_Handler to be located at a specific location. This is different from STM32, which always read Reset_handler address from the vector table (RESET section in our case).

The so called old way or new way only affects how the STACK and HEAP are configured.

@bgolab You mixed different things up. > The old-way of controlling linker settings in such simple scenario like this (just moving the code region to SRAM area) wasn't so bad;) The Old way won't help. This is because RP2040 BOOTROM only wants the Reset_Handler to be located at a specific location. This is different from STM32, which always read Reset_handler address from the vector table (RESET section in our case). The so called old way or new way only affects how the STACK and HEAP are configured.
bgolab commented 2024-05-23 12:36:54 -05:00 (Migrated from github.com)

Yes, I see. Got used to STM32;)

Yes, I see. Got used to STM32;)
GorgonMeducer commented 2024-05-23 12:38:14 -05:00 (Migrated from github.com)

Current solution, i.e. using --entry=Reset_Handler is just a workaround. PRi team needs a more elegant way to place Reset_Handler at 0x2000-0000

Current solution, i.e. using `--entry=Reset_Handler` is just a workaround. PRi team needs a more elegant way to place Reset_Handler at 0x2000-0000
bgolab commented 2024-05-23 12:42:52 -05:00 (Migrated from github.com)

It looks like the RP2 is not officially supported yet:
https://www.keil.com/dd/

It looks like the RP2 is not officially supported yet: https://www.keil.com/dd/
GorgonMeducer commented 2024-05-23 13:31:52 -05:00 (Migrated from github.com)

@bgolab It is the legacy list...
Please check here: https://www.keil.arm.com/packs/rp2xxx_dfp-raspberrypi/boards/

@bgolab It is the legacy list... Please check here: https://www.keil.arm.com/packs/rp2xxx_dfp-raspberrypi/boards/
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#877
No description provided.