Skip to content

Commit

Permalink
Merge branch 'developing' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Sep 27, 2021
2 parents 81fb972 + 311f24c commit 0105427
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 22 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pico_Template (v1.3.0)
# Pico_Template (v1.3.1)
An MDK template for Raspberry Pi Pico

- Compiler: Arm Compiler 6.15 and above (Using non-intrusive wrapper to support pico-sdk which is written in GCC)
Expand All @@ -8,7 +8,7 @@ An MDK template for Raspberry Pi Pico
- Provide users an option to use the ***stdio*** solution from ***pico-sdk (by default)*** or retarget the ***stdin/stdout*** to a user specified location directly. (See note in ***env_wrapper.c***).
- Support Debug in MDK
- [Using J-Link](https://wiki.segger.com/Raspberry_Pi_Pico) (Not Validated in MDK)
- [Using CMSIS-DAP](https://github.com/majbthrd/pico-debug) (Validated in MDK)
- [Using CMSIS-DAP](https://github.com/majbthrd/pico-debug) (Validated in MDK and **highly recommended**)
- Add dedicated project configurations for:
- [**AC6-flash**] Running code in Flash (XIP)
- [**AC6-RunInSRAM**] Running code in SRAM (code is still stored in FLASH)
Expand Down Expand Up @@ -124,7 +124,7 @@ Pico-Template provides a dedicated project configuration for downloading and deb

1. Boot the Pico with the BOOTSEL button pressed.
2. Drag and drop **pico-debug-gimmecache.uf2 **to RPI-RP2 mass-storage driver in the explorer. It immediately reboots as a CMSIS-DAP adapter. Pico-debug loads as a RAM only .uf2 image, meaning that it is never written to flash and doesn't replace existing user code.
3. Open your project which is based on our Pico-Template and switch to DebugInSRAM configuration.
3. Open your project which is based on our Pico-Template and switch to ***DebugInSRAM*** configuration.
4. Compile and Debug
5. Enjoy...

Expand Down
4 changes: 4 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ int main(void)

while (true) {
breath_led();
//gpio_put(PICO_DEFAULT_LED_PIN, 1);
//sleep_ms(500);
//gpio_put(PICO_DEFAULT_LED_PIN, 0);
//sleep_ms(500);
}
//return 0;
}
20 changes: 12 additions & 8 deletions project/mdk/RP2040_debug_in_sram.sct
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ LR_IROM1 0x20000000 SRAM_SIZE { ; load region size_region
startup_RP2040.o (+RO)
}

ER_MUTEX_ARRAY +0 {
* (.mutex_array.*)
* (.mutex_array)
}

RW_IRAM_CODE +0 {
* (+RO-CODE)
* (+XO)
}

ARM_LIB_STACK +0 ALIGN 8 EMPTY STACK_0_SIZE {
}

Expand All @@ -54,10 +64,7 @@ LR_IROM1 0x20000000 SRAM_SIZE { ; load region size_region
ARM_LIB_HEAP_ONE +0 ALIGN 8 EMPTY HEAP_1_SIZE {
}

ER_MUTEX_ARRAY +0 {
* (.mutex_array.*)
* (.mutex_array)
}


;ER_PREINIT_ARRAY +0 {
; * (.preinit_array.*)
Expand All @@ -72,10 +79,7 @@ LR_IROM1 0x20000000 SRAM_SIZE { ; load region size_region
*(.uninitialized_data*)
}

RW_IRAM_CODE +0 {
* (+RO-CODE)
* (+XO)
}


}

11 changes: 9 additions & 2 deletions project/mdk/debug_with_cmsis-dap.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@

RESET
G, Reset_Handler
FUNC void reset_pico(void)
{
exec("RESET");
exec("G, Reset_Handler");
}

DEFINE BUTTON "Reset Pico", "reset_pico()"

reset_pico();
2 changes: 1 addition & 1 deletion project/mdk/debug_with_cmsis-dap_in_ram.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

LOAD .\Objects\template.axf INCREMENTAL


FUNC void debug_from_ram(void)
{
Expand Down
1 change: 1 addition & 0 deletions project/mdk/startup_RP2040.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ void __pico_entry(void)
__NO_RETURN void Reset_Handler(void)
{
SCB->VTOR = (uintptr_t)__VECTOR_TABLE;
__set_MSP((uintptr_t)(&__INITIAL_SP));
//SystemInit(); /* CMSIS System Initialization */
__PROGRAM_START(); /* Enter PreMain (C library entry point) */
}
Expand Down
21 changes: 14 additions & 7 deletions project/mdk/template.uvoptx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>1</tGomain>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
Expand Down Expand Up @@ -135,7 +135,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)</Name>
<Name>(1010=724,527,1135,1029,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
Expand Down Expand Up @@ -167,6 +167,13 @@
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<ToolboxButtons>
<Wi>
<IntNumber>0</IntNumber>
<FirstString>Reset Pico</FirstString>
<SecondString>reset_pico()</SecondString>
</Wi>
</ToolboxButtons>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
Expand All @@ -181,7 +188,7 @@
<viewmode>1</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<aTbox>1</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
Expand Down Expand Up @@ -471,7 +478,7 @@
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>0</tGomain>
<tGomain>1</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
Expand Down Expand Up @@ -502,7 +509,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>CMSIS_AGDI</Key>
<Name>-X"Any" -UAny -O206 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(0BC12477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN0</Name>
<Name>-X"Any" -UAny -O718 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(0BC12477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN0</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
Expand All @@ -517,7 +524,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(1007=105,137,312,358,0)(1008=90,121,466,357,0)(1012=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)</Name>
<Name>(1010=745,553,1156,1055,0)(1007=105,137,312,358,0)(1008=90,121,466,357,0)(1012=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
Expand Down Expand Up @@ -545,7 +552,7 @@
<Mm>
<WinNumber>1</WinNumber>
<SubType>1</SubType>
<ItemText>0x4005801C</ItemText>
<ItemText>0x2000AC00</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
Expand Down
2 changes: 1 addition & 1 deletion project/mdk/template.uvprojx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>7</Optim>
<Optim>6</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
Expand Down
1 change: 1 addition & 0 deletions project/mdk/wrapper/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void runtime_init(void) {
hw_clear_alias(padsbank0_hw)->io[28] = hw_clear_alias(padsbank0_hw)->io[29] = PADS_BANK0_GPIO0_IE_BITS;
#endif
#endif

extern mutex_t __mutex_array_start;
extern mutex_t __mutex_array_end;

Expand Down

0 comments on commit 0105427

Please sign in to comment.