This is an automated email from the ASF dual-hosted git repository. jerzy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 84e5b91b857af31ee61e75a6d3488ab9124d4070 Author: Jerzy Kasenberg <[email protected]> AuthorDate: Wed Jun 16 10:54:30 2021 +0200 Remove redundant sbrk.c files form bsps All bsps that had similar implementation of _sbrk and _sbrkInit are now using those functions provided by hal --- hw/bsp/ada_feather_nrf52/src/sbrk.c | 59 --------------------- hw/bsp/arduino_primo_nrf52/src/sbrk.c | 59 --------------------- hw/bsp/bbc_microbit/src/sbrk.c | 57 -------------------- hw/bsp/ble400/src/sbrk.c | 57 -------------------- hw/bsp/bmd200/src/sbrk.c | 57 -------------------- hw/bsp/bmd300eval/src/sbrk.c | 57 -------------------- hw/bsp/calliope_mini/src/sbrk.c | 57 -------------------- hw/bsp/dialog_cmac/src/sbrk.c | 58 --------------------- hw/bsp/dialog_da1469x-dk-pro/src/sbrk.c | 57 -------------------- hw/bsp/dwm1001-dev/src/sbrk.c | 59 --------------------- hw/bsp/embarc_emsk/src/sbrk.c | 60 ---------------------- hw/bsp/fanstel-ev-bt840/src/sbrk.c | 59 --------------------- hw/bsp/hifive1/src/sbrk.c | 59 --------------------- hw/bsp/nina-b1/src/sbrk.c | 59 --------------------- hw/bsp/nordic_pca10028-16k/src/sbrk.c | 57 -------------------- hw/bsp/nordic_pca10028/src/sbrk.c | 57 -------------------- hw/bsp/nordic_pca10040/src/sbrk.c | 59 --------------------- hw/bsp/nordic_pca10056/src/sbrk.c | 59 --------------------- hw/bsp/nordic_pca10090/src/sbrk.c | 60 ---------------------- hw/bsp/nordic_pca10095/src/sbrk.c | 60 ---------------------- hw/bsp/nordic_pca10095_net/src/sbrk.c | 60 ---------------------- hw/bsp/nordic_pca20020/src/sbrk.c | 59 --------------------- .../src/arch/cortex_m0/gcc_startup_nrf51.s | 4 ++ hw/bsp/nrf51-arduino_101/src/sbrk.c | 49 ------------------ hw/bsp/nrf51-blenano/src/sbrk.c | 57 -------------------- hw/bsp/pinetime/src/sbrk.c | 58 --------------------- hw/bsp/puckjs/src/sbrk.c | 59 --------------------- hw/bsp/rb-blend2/src/sbrk.c | 59 --------------------- hw/bsp/rb-nano2/src/sbrk.c | 59 --------------------- hw/bsp/reel_board/src/sbrk.c | 59 --------------------- hw/bsp/ruuvitag_rev_b/src/sbrk.c | 59 --------------------- hw/bsp/telee02/src/sbrk.c | 59 --------------------- hw/bsp/usbmkw41z/src/sbrk.c | 57 -------------------- hw/bsp/vbluno51/src/sbrk.c | 59 --------------------- hw/bsp/vbluno52/src/sbrk.c | 59 --------------------- 35 files changed, 4 insertions(+), 1978 deletions(-) diff --git a/hw/bsp/ada_feather_nrf52/src/sbrk.c b/hw/bsp/ada_feather_nrf52/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/ada_feather_nrf52/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/arduino_primo_nrf52/src/sbrk.c b/hw/bsp/arduino_primo_nrf52/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/arduino_primo_nrf52/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/bbc_microbit/src/sbrk.c b/hw/bsp/bbc_microbit/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/bbc_microbit/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/ble400/src/sbrk.c b/hw/bsp/ble400/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/ble400/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/bmd200/src/sbrk.c b/hw/bsp/bmd200/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/bmd200/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/bmd300eval/src/sbrk.c b/hw/bsp/bmd300eval/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/bmd300eval/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/calliope_mini/src/sbrk.c b/hw/bsp/calliope_mini/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/calliope_mini/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/dialog_cmac/src/sbrk.c b/hw/bsp/dialog_cmac/src/sbrk.c deleted file mode 100644 index 6402c8a..0000000 --- a/hw/bsp/dialog_cmac/src/sbrk.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) -{ - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/dialog_da1469x-dk-pro/src/sbrk.c b/hw/bsp/dialog_da1469x-dk-pro/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/dialog_da1469x-dk-pro/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/dwm1001-dev/src/sbrk.c b/hw/bsp/dwm1001-dev/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/dwm1001-dev/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/embarc_emsk/src/sbrk.c b/hw/bsp/embarc_emsk/src/sbrk.c deleted file mode 100644 index 779f978..0000000 --- a/hw/bsp/embarc_emsk/src/sbrk.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) -{ - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/fanstel-ev-bt840/src/sbrk.c b/hw/bsp/fanstel-ev-bt840/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/fanstel-ev-bt840/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/hifive1/src/sbrk.c b/hw/bsp/hifive1/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/hifive1/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nina-b1/src/sbrk.c b/hw/bsp/nina-b1/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/nina-b1/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nordic_pca10028-16k/src/sbrk.c b/hw/bsp/nordic_pca10028-16k/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/nordic_pca10028-16k/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nordic_pca10028/src/sbrk.c b/hw/bsp/nordic_pca10028/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/nordic_pca10028/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nordic_pca10040/src/sbrk.c b/hw/bsp/nordic_pca10040/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/nordic_pca10040/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nordic_pca10056/src/sbrk.c b/hw/bsp/nordic_pca10056/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/nordic_pca10056/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nordic_pca10090/src/sbrk.c b/hw/bsp/nordic_pca10090/src/sbrk.c deleted file mode 100644 index 779f978..0000000 --- a/hw/bsp/nordic_pca10090/src/sbrk.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) -{ - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nordic_pca10095/src/sbrk.c b/hw/bsp/nordic_pca10095/src/sbrk.c deleted file mode 100644 index 779f978..0000000 --- a/hw/bsp/nordic_pca10095/src/sbrk.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) -{ - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nordic_pca10095_net/src/sbrk.c b/hw/bsp/nordic_pca10095_net/src/sbrk.c deleted file mode 100644 index 779f978..0000000 --- a/hw/bsp/nordic_pca10095_net/src/sbrk.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) -{ - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nordic_pca20020/src/sbrk.c b/hw/bsp/nordic_pca20020/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/nordic_pca20020/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nrf51-arduino_101/src/arch/cortex_m0/gcc_startup_nrf51.s b/hw/bsp/nrf51-arduino_101/src/arch/cortex_m0/gcc_startup_nrf51.s index 4b2a5e4..1bcd1bc 100644 --- a/hw/bsp/nrf51-arduino_101/src/arch/cortex_m0/gcc_startup_nrf51.s +++ b/hw/bsp/nrf51-arduino_101/src/arch/cortex_m0/gcc_startup_nrf51.s @@ -180,6 +180,10 @@ Reset_Handler: bgt .LC1 .LC0: + LDR R0, =__HeapBase + LDR R1, =__HeapLimit + BL _sbrkInit + LDR R0, =SystemInit BLX R0 diff --git a/hw/bsp/nrf51-arduino_101/src/sbrk.c b/hw/bsp/nrf51-arduino_101/src/sbrk.c deleted file mode 100644 index cee2590..0000000 --- a/hw/bsp/nrf51-arduino_101/src/sbrk.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -extern char __HeapBase; -extern char __HeapLimit; - -static char *brk = &__HeapBase; -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < &__HeapBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (&__HeapLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/nrf51-blenano/src/sbrk.c b/hw/bsp/nrf51-blenano/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/nrf51-blenano/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/pinetime/src/sbrk.c b/hw/bsp/pinetime/src/sbrk.c deleted file mode 100644 index 6402c8a..0000000 --- a/hw/bsp/pinetime/src/sbrk.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) -{ - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/puckjs/src/sbrk.c b/hw/bsp/puckjs/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/puckjs/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/rb-blend2/src/sbrk.c b/hw/bsp/rb-blend2/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/rb-blend2/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/rb-nano2/src/sbrk.c b/hw/bsp/rb-nano2/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/rb-nano2/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/reel_board/src/sbrk.c b/hw/bsp/reel_board/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/reel_board/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/ruuvitag_rev_b/src/sbrk.c b/hw/bsp/ruuvitag_rev_b/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/ruuvitag_rev_b/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/telee02/src/sbrk.c b/hw/bsp/telee02/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/telee02/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/usbmkw41z/src/sbrk.c b/hw/bsp/usbmkw41z/src/sbrk.c deleted file mode 100644 index 3fe253e..0000000 --- a/hw/bsp/usbmkw41z/src/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/vbluno51/src/sbrk.c b/hw/bsp/vbluno51/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/vbluno51/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -} diff --git a/hw/bsp/vbluno52/src/sbrk.c b/hw/bsp/vbluno52/src/sbrk.c deleted file mode 100644 index 5df43c9..0000000 --- a/hw/bsp/vbluno52/src/sbrk.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <hal/hal_bsp.h> - -/* put these in the data section so they are not cleared by _start */ -static char *sbrkBase __attribute__ ((section (".data"))); -static char *sbrkLimit __attribute__ ((section (".data"))); -static char *brk __attribute__ ((section (".data"))); - -void -_sbrkInit(char *base, char *limit) { - sbrkBase = base; - sbrkLimit = limit; - brk = base; -} - -void * -_sbrk(int incr) -{ - void *prev_brk; - - if (incr < 0) { - /* Returning memory to the heap. */ - incr = -incr; - if (brk - incr < sbrkBase) { - prev_brk = (void *)-1; - } else { - prev_brk = brk; - brk -= incr; - } - } else { - /* Allocating memory from the heap. */ - if (sbrkLimit - brk >= incr) { - prev_brk = brk; - brk += incr; - } else { - prev_brk = (void *)-1; - } - } - - return prev_brk; -}
